Skip to content

Instantly share code, notes, and snippets.

@adrianlzt
Created March 18, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianlzt/94e2fd5783a8d0f0e5655ae85e645915 to your computer and use it in GitHub Desktop.
Save adrianlzt/94e2fd5783a8d0f0e5655ae85e645915 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Testing snap</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script>
<script>
window.onload = function () {
var g = Snap();
g.attr({
viewBox: [0, 0, 800, 600]
});
Snap.load("map2.svg", function (f) {
var pth = f.select("#formamano"),
bola = f.select("#bola"),
mano = f.select("#mano"),
top = g.g();
top.add(bola);
var len = Snap.path.getTotalLength(pth.attr("d"));
Snap.animate(0, len, function (l) {
var dot = pth.getPointAtLength(l);
bola.attr({
transform: "t" + [dot.x, dot.y]
});
}, 3000, null, function () {
top.add(mano);
});
});
};
</script>
</head>
<body>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="1000px"
height="400px"
viewBox="0 0 1000 400"
enable-background="new 0 0 1000 400"
xml:space="preserve"
sodipodi:docname="map2.svg"
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
id="metadata4598"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs4596"><inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="209.1236 : -1.5649162 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="1209.1236 : -1.5649162 : 1"
inkscape:persp3d-origin="709.1236 : -68.231586 : 1"
id="perspective4677" />
</defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="1041"
id="namedview4594"
showgrid="false"
showguides="false"
inkscape:zoom="1.8040658"
inkscape:cx="166.09646"
inkscape:cy="349.57193"
inkscape:window-x="1280"
inkscape:window-y="18"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<g
id="mano"
transform="matrix(3.5223624,0,0,3.5223624,132.02867,60.414451)"
inkscape:label="#g4994-7"><path
id="path4959-5"
d="m 13.5,31.5 c 0,-2.6 2.4,-4.7 5.3,-4.7 h 0.1 c 2.9,0 6.3,2.1 6.3,4.7 L 22.6,6.4 C 22.6,4 25.6,2 29.5,2 h 0.1 c 3.8,0 6.9,2 6.9,4.4 L 35.3,31 c 0,-2.6 2.4,-4.7 5.3,-4.7 h 0.1 c 2.9,0 5.3,2.1 5.3,4.7 v 2.7 c 0.5,-1.9 2.4,-3.2 4.6,-2.7 4.5,1.2 3.6,4.8 4.1,8.7 0.5,4.8 1.7,7.9 1.3,9.6 -1,3.7 -3.7,3.2 -5.1,4.2 -1.4,1 -1.8,2.6 -2.9,3.6 -2.2,2 -6.2,1.6 -9.8,2.5 -3.1,0.8 -5.9,2.6 -8.3,2.3 -2.7,-0.3 -3.4,-2.6 -6.4,-4 -3,-1.4 -7.1,-0.7 -8.3,-3.1 C 12.9,50 13.5,31.5 13.5,31.5"
inkscape:connector-curvature="0"
style="fill:#ffdd67" /><g
id="g4971-3"
style="fill:#eba352"><path
id="path4961-5"
d="m 13.5,31.5 c 0,-1.4 0.7,-2.7 1.8,-3.5 -1.9,2.4 -0.6,19.4 1.7,24.2 1.2,2.4 5.3,1.7 8.3,3.1 3,1.4 3.7,3.8 6.4,4 2.4,0.3 5.2,-1.4 8.3,-2.1 3.6,-0.9 6.1,-0.6 8.3,-2.6 1.1,-1 1.6,-2.5 3.8,-3.2 1.6,-0.5 2.7,-1 3.9,-2.2 0,0 0,0.1 0,0.1 -1,3.7 -3.7,3.2 -5.1,4.2 -1.4,1 -1.8,2.6 -2.9,3.6 -2.2,2 -6.2,1.6 -9.8,2.5 -3.1,0.8 -5.9,2.6 -8.3,2.3 -2.7,-0.3 -3.4,-2.6 -6.4,-4 -3,-1.4 -7.1,-0.7 -8.3,-3.1 C 12.9,50 13.5,31.5 13.5,31.5"
inkscape:connector-curvature="0" /><path
id="path4963-6"
d="m 22.6,5.3 c -0.9,3.8 2.5,38.4 2.5,38.4 0,2.5 1.3,1.5 1.3,-1 0,0 -3.6,-32.5 -2.6,-37.3 0.4,-2 1.8,-2.6 4.2,-3.3 0,0 -4.6,0.2 -5.4,3.2"
inkscape:connector-curvature="0" /><path
id="path4965-2"
d="m 37,42.3 v -13 c 0,-0.7 0.1,-1.4 0.5,-2 -1.3,0.9 -2.1,2.2 -2.1,3.7 v 13 c -0.1,2.7 1.6,0.9 1.6,-1.7"
inkscape:connector-curvature="0" /><path
id="path4967-9"
d="M 47.4,43.6 V 33.2 c 0,-0.6 0.1,-1.2 0.4,-1.8 -1.1,0.8 -1.9,2 -1.9,3.4 v 10.4 c 0,2.3 1.5,0.7 1.5,-1.6"
inkscape:connector-curvature="0" /><path
id="path4969-1"
d="m 34.4,10.8 c 0.8,-5.3 -1.7,-5.5 -4.8,-5.5 -3.1,0 -5.6,0.2 -4.8,5.5 0.3,2 2.4,2.7 4.8,2.7 2.4,0 4.5,-0.8 4.8,-2.7"
inkscape:connector-curvature="0" /></g><path
id="path4973-2"
d="M 34.5,9.9 C 35.3,4.2 32.8,4 29.6,4 c -3.2,0 -5.7,0.2 -4.9,5.8 0.3,2.1 2.4,2.8 4.9,2.8 2.5,0 4.6,-0.7 4.9,-2.7"
inkscape:connector-curvature="0"
style="fill:#ffe8dc" /><path
id="path4975-7"
d="m 15.2,53.6 c -3.6,-4.2 -8.3,-6.4 -7.1,-9.5 1,-3 3.1,-2.9 5.8,-6.3 l 1.3,15.8"
inkscape:connector-curvature="0"
style="fill:#eba352" /></g><path
style="fill:none;stroke:#000000;stroke-width:3.52236247;stroke-opacity:1"
d="m 1.7610916,-2.1053442 c 0.065801,-6.5208496 0.187346,-10.8313398 0.187346,-10.8313398 0,-9.15814 8.4531174,-16.55469 18.6679684,-16.55469 h 0.353516 c 9.421004,0 20.332404,6.29252 21.972656,14.45508 l -8.941406,-86.312496 c 0,-8.45367 10.567471,-15.49805 24.304691,-15.49805 h 0.35351 c 13.38498,0 24.302745,7.04438 24.302745,15.49805 l -4.22657,86.650386 c 0,-9.15814 8.45508,-16.55469 18.669931,-16.55469 h 0.35156 c 10.214851,0 18.667971,7.39655 18.667971,16.55469 v 9.5097602 c 1.76118,-6.6924902 8.45393,-11.2709402 16.20312,-9.5097602 9.17784,2.44743 11.97587,7.7338902 13.04843,14.41552929"
id="formamano"
inkscape:connector-curvature="0"
inkscape:label="#path4959-5-9" /><circle
style="fill:#000000;fill-opacity:0.59344262;fill-rule:nonzero;stroke:#e30000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="bola"
cx="179.32979"
cy="180.9675"
r="4.7241778"
inkscape:label="#path4633" /></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment