collinhover / impactplusplus

Impact++ is a collection of additions to ImpactJS with full featured physics, dynamic lighting, UI, abilities, and more.
http://collinhover.github.com/impactplusplus
MIT License
276 stars 58 forks source link

Camera shake: Third Parameter? #132

Closed Pattentrick closed 10 years ago

Pattentrick commented 10 years ago

Working on the camera tutorial right now. What's the idea behind the third parameter (fn) of the shake method? Is this for defining an own multiplier for the "shakiness"?

aroth commented 10 years ago

Looks like you can pass in a custom shake function, otherwise it defaults to:

var value = this.shakeFunction ? this.shakeFunction() : ( this.shakeStrength * Math.pow(deltaPct, 2) );
aroth commented 10 years ago

More specifically:

in #shake: this.shakeFunction = fn || this.shakeFunction; in #updateShake: var value = this.shakeFunction ? this.shakeFunction() : ( this.shakeStrength * Math.pow(deltaPct, 2) );

Pattentrick commented 10 years ago

@aroth Thanks for explaining. I will experiment with that. Glad to know that you are still around here.

collinhover commented 10 years ago

@aroth is correct =)