src/pattern/flicker.js in entityjs-0.3.1 vs src/pattern/flicker.js in entityjs-0.3.2
- old
+ new
@@ -25,11 +25,11 @@
this.stepProgress = 0;
this.off('update', this.flicker_update);
- return this.trigger('flicker:end', o);
+ return this.trigger('flicker:finish', o);
},
flicker_update:function(t){
this.timestep(t, function(){
@@ -67,11 +67,10 @@
addFlicker:function(id, loops, duration, frames){
if(re.is(id, 'object')){
for(var i in id){
- if(!id.hasOwnProperty(i)) continue;
//copy formed array and insert
var c = id[i].slice();
//add key into array
c.unshift(i);
@@ -99,11 +98,10 @@
removeFlicker:function(id){
if(re.is(id,'object')){
for(var i in id){
- if(!id.hasOwnProperty(i)) continue;
this.removeFlicker.call(this, id[i]);
}
return this;
@@ -164,17 +162,23 @@
//create new reel based on custom attributes
var c = this.flicker_reel;
//copy from saved animation or newly given
c.loops = (isNaN(loops))? r.loops : loops;
c.duration = (isNaN(duration))? r.duration : duration;
+
+ //convert to seconds
+ if(c.duration >= 30){
+ c.duration /= 1000;
+ }
+
c.frames = (re.is(frames,'object'))? frames : r.frames;
//setup counter for loops
this.flicker_loops = c.loops;
this.stepProgress = 0;
- this.stepSize = c.duration / c.frames.length / 1000;
-
+ this.stepSize = c.duration / c.frames.length;
+
//save old frames for upon completion
this.flicker_frame = 0;
//update frame then run
\ No newline at end of file