Skip to content

Instantly share code, notes, and snippets.

@kawabataryo
Last active August 29, 2015 14:06
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 kawabataryo/5a53f504155c0cbe8d10 to your computer and use it in GitHub Desktop.
Save kawabataryo/5a53f504155c0cbe8d10 to your computer and use it in GitHub Desktop.
JS Flame Animation
(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);
(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