controllerScrollSpring

scrollSpring(strength, spring_acc, spring_vdamp) scrollSpring.messages = [] scrollSpring.events = []

Description

Causes the element to 'spring' (shake) in 2D space around its position when the browser's viewport moves. This controller does not use the physics engine, and so it doesn't need a slow() controller - it has its own velocity damping regulated via parameter spring_vdamp.

Applies one translate transform.

Parameters

Visit page Controller # Common Parameters for documentation on the parameters, common to all controllers: id, paused and disabled.

Parameters of scrollSpring():

strength
The 'spring' is pulled with an amount proportional to the window's scrolling step multiplied by this parameter. Larger values result is bigger amplitude of movement. Negative values result in 'pulling' in the opposite direction. Default value: 1
spring_acc
This parameter regulates how fast the spring moves. A larger value results in faster movement. Note that setting too high of a value will cause a self-amplifying spring movement. What is the highest value before the positive feedback kicks in depends on the value of spring_vdamp, but values up to 2 are always safe. Default value: 0.1
spring_vdamp
Every frame the current speed of the spring is multiplied by this parameter, effectively slowing the movement. Values between 0 and 1 are reasonable, where smaller values result in faster dying of the movement and a value of 1 means absolute elasticity of the spring. Default value: 0.8

Accepted Messages

Visit page Controller # Common Messages for documentation on the messages, accepted by all controllers: pause, unpause, enable, disable, params and remove.

Messages specific to scrollSpring(): none

Generated Events

Visit page Controller # Common Events for documentation on the events, generated by all controllers: frame, remove, paused, unpaused enabled and disabled.

Events specific to scrollSpring(): none

Interaction with DOM

Changes Log

  1. Controller introduced in v.0.80

See Also