- 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
Vector
Three-element floating point vector.
Overview
Options
Methods
Vector(x, y, z)
Constructor Parameters
x
Number
x element value
y
Number
y element value
z
Number
z element value
Methods
add(v)
Add this element-wise to another Vector, element-wise. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
sub(v)
Subtract another vector from this vector, element-wise. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
mult(r)
Scale Vector by floating point r. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
div(r)
Scale Vector by floating point 1/r. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
cross(v)
Given another vector v, return cross product (v)x(this). Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
equals(v)
Component-wise equality test between this and Vector v.
Parameters
Returns
rotateX(theta)
Rotate clockwise around x-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
rotateY(theta)
Rotate clockwise around y-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
rotateZ(theta)
Rotate clockwise around z-axis by theta radians. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
dot(v)
Return dot product of this with a second Vector
Parameters
Returns
normSquared()
Return squared length of this vector
Returns
norm()
Return length of this vector
Returns
normalize(length)
Scale Vector to specified length. If length is less than internal tolerance, set vector to [length, 0, 0]. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
clone()
Make a separate copy of the Vector.
Returns
isZero()
True if and only if every value is 0 (or falsy)
Returns
set(v)
Set this Vector to the values in the provided Array or Vector.
Parameters
Returns
put(v)
Put result of last internal register calculation in specified output vector.
Parameters
Returns
clear()
Set this vector to [0,0,0]
cap()
Scale this Vector down to specified "cap" length. If Vector shorter than cap, or cap is Infinity, do nothing. Note: This sets the internal result register, so other references to that vector will change.
Returns
project(n)
Return projection of this Vector onto another. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
reflectAcross(n)
Reflect this Vector across provided vector. Note: This sets the internal result register, so other references to that vector will change.
Parameters
Returns
get()
Convert Vector to three-element array.