Snap.svg hiding and showing objects from different layers of existing svg file -
i have defined variable 'circle' on hidden layer of svg. know how show , hide again.
edit: aright, i'm sorry wasn't specific. i'm beginner :) have .svg file 2 circles - black , grey. i'd black button appear when grey 1 hovered. point is, circles on different layers , manage visibility inkscape(hide elements on given layer). here's fragment code of svg file contains inkscape meta "grey" layer:
<g inkscape:label="grey" inkscape:groupmode="layer" id="layer1" transform="translate(-8.571418,-6.6478954)"> <path sodipodi:type="arc" style="fill:#a4a4a4;fill-opacity:1;fill-rule:nonzero;stroke:none" id="grey" sodipodi:cx="180" sodipodi:cy="289.50504" sodipodi:rx="90" sodipodi:ry="90" d="m 270,289.50504 c 0,49.70562 -40.29437,90 -90,90 -49.70563,0 -90,-40.29438 -90,-90 0,-49.70563 40.29437,-90 90,-90 49.70563,0 90,40.29437 90,90 z" transform="translate(-67.142862,-184.28571)" />
and here's html:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>button</title> <script src="snap.svg-min.js"></script> <script> window.onload = function () { var s = snap("#icondiv"); snap.load("button.svg", function(f) { grey = f.select("#grey"); black = f.select("#black"); grey.hover(function() { black.animate({y:200}, 200, mina.elastic); }, function() { black.animate({y:180}, 200, mina.elastic); } ); s.append(f); }); }; </script> </head> <body> <div id="icondiv"></div> </body> </html>
Comments
Post a Comment