Created
March 18, 2018 18:55
-
-
Save adrianlzt/94e2fd5783a8d0f0e5655ae85e645915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment