SpringChain class
SpringChain is a helper class for creating spring animations with multiple springs in a chain. Chains of springs can be used to create cascading animations that maintain individual physics state for each member of the chain. One spring in the chain is chosen to be the control spring. Springs before and after the control spring in the chain are pulled along by their predecessor. You can change which spring is the control spring at any point by calling {@link SpringChain#setControlSpringIndex(int)}.
- Implemented types
Constructors
- SpringChain(TickerProvider vsync, {double mainTension = _DEFAULT_MAIN_TENSION, double mainFriction = _DEFAULT_MAIN_FRICTION, double attachmentTension = _DEFAULT_ATTACHMENT_TENSION, double attachmentFriction = _DEFAULT_ATTACHMENT_FRICTION})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addSpring(
SpringListener listener) → SpringChain - Add a spring to the chain that will callback to the provided listener. @param listener the listener to notify for this Spring in the chain @return this SpringChain for chaining
-
dispose(
) → void -
getAllSprings(
) → List< Spring> - Retrieve the list of springs in the chain. @return the list of springs
-
getAttachmentSpringConfig(
) → SpringConfig -
getControlSpring(
) → Spring - Retrieve the control spring so you can manipulate it to drive the positions of the other springs. @return the control spring.
-
getMainSpringConfig(
) → SpringConfig -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onSpringActivate(
Spring spring) → void -
called whenever the spring leaves its resting state
@param spring the spring that has left its resting state
override
-
onSpringAtRest(
Spring spring) → void -
called whenever the spring achieves a resting state
@param spring the spring that's now resting
override
-
onSpringEndStateChange(
Spring spring) → void -
called whenever the spring notifies of displacement state changes
@param spring the spring whose end state has changed
override
-
onSpringUpdate(
Spring spring) → void -
called whenever the spring is updated
@param spring the Spring sending the update
override
-
setControlSpringIndex(
int i) → SpringChain - Set the index of the control spring. This spring will drive the positions of all the springs before and after it in the list when moved. @param i the index to use for the control spring @return this SpringChain
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- registry → SpringConfigRegistry
-
Add these spring configs to the registry to support live tuning through the
{@link com.facebook.rebound.ui.SpringConfiguratorView}
final
Static Methods
-
create(
TickerProvider vsync, {double mainTension = _DEFAULT_MAIN_TENSION, double mainFriction = _DEFAULT_MAIN_FRICTION, double attachmentTension = _DEFAULT_ATTACHMENT_TENSION, double attachmentFriction = _DEFAULT_ATTACHMENT_FRICTION}) → SpringChain - Factory method for creating a new SpringChain with the provided SpringConfig. @param mainTension tension for the main spring @param mainFriction friction for the main spring @param attachmentTension tension for the attachment spring @param attachmentFriction friction for the attachment spring @return the newly created SpringChain