Closed renatodeleao closed 6 years ago
@renatodeleao what do you think of this Boolean way of starting/pausing/resuming?
@tomasmcm like the way ya think, slightly disagree on execution of slowmotion methods. I do like boolean flags for the checks, but i don't like the smell of two different methods for a toggle state function :p.
If you're using booleans for pause this.paused
why not do the same for slowmotion? also plus 1 for consistency!
constructor{
...
// Flags
this.paused = false;
this.slowmotion = false;
}
/**
* --------------------
* ANIMATION
* --------------------
*/
slowMotion(){
this.slowmotion = !this.slowmotion; // toggle if on goes off, if off goes on
if (this.slowmotion){
this.speed = this.speed/2;
} else {
this.speed = this.lastKnownSpeed; //[1]
}
}
// events
addEvents(){
this.flooper.addEventListener('mouseenter', this.slowMotion, false);
this.flooper.addEventListener('mouseleave', this.slowMotion, false);
}
What do you think? maybe change the method name for checkSlowMotion()
or toggleSlowMotion()
? or we can leave it as is.
Everything else 🎊 !!
(also if you want me to rebase the mess left from the dev env PR, let me know.)
@renatodeleao you're absolutely right, I focused on the play/pause logic and didn't even looked at the slowMotion functions. That's way better, and consistent! I can fix this tomorrow and merge
@tomasmcm I have to rebase this to fix the mess left by the previous PR, so i can update if for you now as i have sublime engine up and running! Thanks for the ✋ !
⏯
Fixes #9
This branch is based on
a-dev-system
and I forgot to squash commits. Help git masters?