- core
- Context
- ElementAllocator
- ElementOutput
- Engine
- Entity
- EventEmitter
- EventHandler
- Group
- Modifier
- OptionsManager
- RenderNode
- Scene
- SpecParser
- Transform
- View
- ViewSequence
- events
- EventArbiter
- EventFilter
- EventMapper
- inputs
- Accumulator
- GenericSync
- MouseSync
- PinchSync
- RotateSync
- ScaleSync
- ScrollSync
- TouchSync
- TouchTracker
- TwoFingerSync
- math
- Matrix
- Quaternion
- Random
- Utilities
- Vector
- modifiers
- Draggable
- Fader
- ModifierChain
- StateModifier
- physics
- PhysicsEngine
- physics/bodies
- Body
- Circle
- Particle
- Rectangle
- physics/constraints
- Surface
- Collision
- Constraint
- Curve
- Distance
- Snap
- Wall
- Walls
- physics/forces
- Drag
- Force
- Repulsion
- RotationalDrag
- RotationalSpring
- Spring
- VectorField
- physics/integrators
- SymplecticEuler
- surfaces
- CanvasSurface
- ContainerSurface
- ImageSurface
- InputSurface
- TextareaSurface
- VideoSurface
- transitions
- CachedMap
- Easing
- MultipleTransition
- SnapTransition
- SpringTransition
- Transitionable
- TransitionableTransform
- TweenTransition
- WallTransition
- utilities
- KeyCodes
- Timer
- Utility
- views
- ContextualView
- Deck
- DrawerLayout
- EdgeSwapper
- FlexibleLayout
- Flipper
- GridLayout
- HeaderFooterLayout
- Lightbox
- RenderController
- ScrollContainer
- Scroller
- Scrollview
- SequentialLayout
- widgets
- NavigationBar
- TabBar
Snap
A spring constraint is like a spring force, except that it is always numerically stable (even for low periods), at the expense of introducing damping (even with dampingRatio set to 0). Use this if you need fast spring-like behavior, e.g., snapping
Overview
Options
period] The amount of time in milliseconds taken for one complete oscillation when there is no damping. Range : [150, Infinity
                  dampingRatio] Additional damping of the spring. Range : [0, 1
                  length] The rest length of the spring. Range: [0, Infinity
                  anchor
                Methods
getEnergy
                  applyConstraint
                Snap(options)
Constructor Parameters
options
Options
An object of configurable options.
period] The amount of time in milliseconds taken for one complete oscillation when there is no damping. Range : [150, Infinity
                      Number
                      
                      
                    dampingRatio] Additional damping of the spring. Range : [0, 1
                      Number
                      . At 0 this spring will still be damped, at 1 the spring will be critically damped (the spring will never oscillate)
                      
                    length] The rest length of the spring. Range: [0, Infinity
                      Number
                      .
                      
                    anchor
                      Array
                      The location of the spring's anchor, if not another physics body.
                      
                    Methods
getEnergy(targets, source)
Calculates energy of spring
Parameters
targets
                    Body
                    target physics body
                    
                  source
                    Body
                    source physics body
                    
                  Returns
Number
                    energy
                  applyConstraint(targets, source, dt)
Adds a spring impulse to a physics body's velocity due to the constraint
Parameters
targets
                    Array.Body
                    Array of bodies to apply the constraint to
                    
                  source
                    Body
                    The source of the constraint
                    
                  dt
                    Number
                    Delta time