Last active
August 29, 2015 14:06
-
-
Save kawabataryo/5a53f504155c0cbe8d10 to your computer and use it in GitHub Desktop.
JS Flame Animation
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
(function(window,namespace,$){ | |
window[namespace] = { | |
play: function(){ | |
var len = this.frame.length; | |
for(var i=0; i<len; i++){ | |
setTimeout(this.frame[i].scene, this.frame[i].timeline); | |
} | |
}, | |
frame: [ | |
{ | |
scene: function(){ | |
console.log(1) | |
}, | |
timeline: 1200 | |
}, | |
{ | |
scene: function(){ | |
console.log(2) | |
}, | |
timeline: 2000 | |
}, | |
{ | |
scene: function(){ | |
console.log(3) | |
}, | |
timeline: 2200 | |
}, | |
{ | |
scene: scene04, | |
timeline: 3500 | |
} | |
] | |
} | |
function scene04(){ | |
console.log(4); | |
console.log(5); | |
console.log(6); | |
} | |
})(this,'FlameAnime',jQuery); |
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
(function(window,namespace,$){ | |
window[namespace] = { | |
play: function(){ | |
var len = this.frame.length; | |
var interval = 0; | |
for(var i=0; i<len; i++){ | |
interval += this.frame[i].interval; | |
setTimeout(this.frame[i].scene, interval); | |
} | |
}, | |
frame: [ | |
{ | |
scene: function(){ | |
console.log(1) | |
}, | |
interval: 1200 | |
}, | |
{ | |
scene: function(){ | |
console.log(2) | |
}, | |
interval: 800 | |
}, | |
{ | |
scene: function(){ | |
console.log(3) | |
}, | |
interval: 200 | |
}, | |
{ | |
scene: scene04, | |
interval: 1300 | |
} | |
] | |
} | |
function scene04(){ | |
console.log(4); | |
console.log(5); | |
console.log(6); | |
} | |
})(this,'FlameAnime',jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment