javascript - How do I place a script with SNAP svg into a div -
i'm trying place snap svg script div , lost how should this. right here html working with:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>oh snap svg 2014</title> <script src="snap.svg-0.1.0/dist/snap.svg-min.js"></script> <style> body{ background:#fff; } </style> </head> <body> <script> var paper= snap(700,600); var c = paper.image("clock machine.svg", 200,100,500,480); var b = paper.image("new years ball.svg", 406,20,200,200); var p = paper.image("button.svg", 258,508,35,35); var l = paper.image("lights.svg",406,20,200,200); var g = paper.group(b,l); var clickfunc= p.click g.transform("r90"); p.click(function(){ g.animate({transform : "t0,227" }, 5000, mina.easein ); t.animate({transform : "t-2557,0,"}, 4900,mina.linear); }); g.attr({x:250}) var t = paper.image("lcd text.svg", 620,453,2500,85).attr({ fill: "#3fff9b" }); var c = paper.rect(365, 454, 263, 85, 3).attr({mask:t, fill:"#3fff9b" }); </script> </body> </html> that have far. know how put div? read documentation , have tried couple of things, results have been futile. obliged.
you can put svg tag inside div , attach that, like...
<div id="mydiv"> <svg id="mysvg"></svg> </div> s = snap("#mysvg"); s.rect(100,100,200,200); example jsfiddle here showing above css on div.
Comments
Post a Comment