Class: Dynamic

PSV.utils.Dynamic

new PSV.utils.Dynamic (fn, defaultValue, min, max, loopValue)

Represents a variable that can dynamically change with time (using requestAnimationFrame)

Name Type Default Description
fn function optional

Callback function

defaultValue number 0 optional

Default position

min number optional

Minimum position

max number optional

Maximum position

loopValue boolean false optional

Loop value between min and max

Members

current number readonly

Methods

goto (position, speedMult)

Defines the target position

Name Type Default Description
position number
speedMult number 1 optional

roll (invert, speedMult)

Starts infinite movement

Name Type Default Description
invert boolean false optional
speedMult number 1 optional

setSpeed (speed)

Changes base speed

Name Type Description
speed number

setValue (value)

Defines the current position and immediately stops movement

Name Type Description
value number

step (step, speedMult)

Increase/decrease the target position

Name Type Default Description
step number
speedMult number 1 optional

stop ()

Stops movement

update () package