Skip to main content

Seadragon.Spring class

Version 0.8.8 - Back to Seadragon Ajax API Reference

Overview

A time-based spring class that moves its current value towards its target value if the two are ever different. The length and shape of the movement are determined by Seadragon.Config.animationTime and Seadragon.Config.springStiffness, respectively.

Note that while this class is time-based, the current value of the spring is only changed on calls to update(). Any calls to modifier methods will not reflect a changed current value until update() is called.

Constructors

SignatureDescription
Seadragon.Spring(initialValue)Creates a spring with the given initial current and target value.

Methods

Name and SignatureReturn TypeDescription
getCurrent()NumberReturns the current value of the spring.
getTarget()NumberReturns the target value of the spring.
resetTo(target)-Sets both the current and target values of the spring to the given value.
shiftBy(delta)-Shifts both the current and target values of the spring by the given amount.
springTo(target)-Sets the target value of the spring to the given value.
update()-Updates the current value of the spring to move closer towards the target value.