Skip to content

Instantly share code, notes, and snippets.

@rlemon

rlemon/file.js Secret

Created March 26, 2015 11:58
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 rlemon/c3834db64e55673e1541 to your computer and use it in GitHub Desktop.
Save rlemon/c3834db64e55673e1541 to your computer and use it in GitHub Desktop.
var items = [
[1, 1, 24, 1, 24, 24, 1, 24],
[26, 1, 49, 1, 49, 24, 26, 24],
[51, 1, 74, 1, 74, 24, 51, 24],
[76, 1, 99, 1, 99, 24, 76, 24]
],
item = [],
points = [],
i;
var s = Snap().attr({
viewBox: "0 0 100 100",
"fill": "#fff"
});
function register(x, i) {
item[i] = s.polygon(items[i]);
item[i].click(function() {
p = items[i];
this.animate({
"points": p[0] + "," + p[1] + ",100,0," + p[4] + "," + p[5] + "," + p[6] + "," + p[7]
}, 120, mina.linear, function() {
this.animate({
"points": p[0] + "," + p[1] + ",100,0,100,0," + p[6] + "," + p[7]
}, 120, mina.linear, function() {
this.animate({
"points": p[0] + "," + p[1] + ",100,0,100,100,0,100"
}, 120, mina.linear, function() {
this.animate({
"points": "0,0,100,0,100,100,0,100"
}, 120, mina.linear, function() {
this.animate({
"points": p
}, 200, mina.linear)
})
})
})
});
});
}
items.forEach(register);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment