- 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
VectorField
A force that moves a physics body to a location with a spring motion. The body can be moved to another physics body, or an anchor point.
Overview
Options
Methods
CONSTANT
LINEAR
RADIAL
POINT_ATTRACTOR
strength
field
setOptions
applyForce
VectorField(options)
Constructor Parameters
options
Object
options to set on drag
Methods
Spring.FORCE_FUNCTIONS()ProtectedStatic
CONSTANT(v, options)
Constant force, e.g., gravity
Parameters
v
Vector
Current position of physics body
options
Object
The direction of the force Pass a {direction : Vector} into the VectorField options
Returns
Number
unscaled force
LINEAR(v)
Linear force
Parameters
v
Vector
Current position of physics body
Returns
Vector
unscaled force
RADIAL(v)
Radial force, e.g., Hookean spring
Parameters
v
Vector
Current position of physics body
Returns
Vector
unscaled force
POINT_ATTRACTOR(v, options)
Point attractor force, e.g., Hookean spring with an anchor
Parameters
v
Vector
Current position of physics body
options
Object
And object with the position of the attractor Pass a {position : Vector} into the VectorField options
Returns
Vector
unscaled force
VectorField.DEFAULT_OPTIONS()ProtectedStatic
strength()
The strength of the force Range : [0, 10]
field()
Type of vectorfield Range : [0, 100]
setOptions(options)
Basic options setter
Parameters
options
Objects
applyForce(targets)
Adds the VectorField's force to a physics body's force accumulator.
Parameters
targets
Array.body
Array of bodies to apply force to.