PDG engine v0.9.5
 All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
Animated Class Reference

something that can be automatically moved, spun or resized over time. More...

Inheritance diagram for Animated:
Inheritance graph
[legend]

Public Member Functions

 accelerate (number deltaSpeed, int msDuration=duration_Instantaneous, int easing=linearTween)
 change the object's speed over time More...
 
 accelerateTo (number speed, int msDuration=duration_Instantaneous, int easing=linearTween)
 change the object's speed to a particular value over time More...
 
 addAnimationHelper (IAnimationHelper helper)
 setup a helper to handle custom animation More...
 
boolean animate (int msElapsed)
 animate based on the passage of time More...
 
 applyForce (Vector force, int msDuration=duration_Instantaneous)
 apply a force to the object over time More...
 
 applyTorque (number forceSpin, int msDuration=duration_Instantaneous)
 apply torque to the object over time More...
 
 changeCenter (Offset offset, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 shift the center point of the object over time More...
 
 changeCenterTo (Offset offset, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 shift the center point of the object to a particular offset from true center over time More...
 
 clearAnimationHelpers ()
 remove all previously added animation helpers More...
 
Rect getBoundingBox ()
 get the rectangle that completely encloses the object More...
 
Offset getCenterOffset ()
 get the current offset of the center relative to the true center point More...
 
number getHeight ()
 get height of the object More...
 
Point getLocation ()
 get the position of the object More...
 
number getMass ()
 get the mass of the object More...
 
number getMoveFriction ()
 get the amount of friction for movement More...
 
number getMovementDirectionInRadians ()
 get the direction the object is moving More...
 
RotatedRect getRotatedBounds ()
 get the bounds with rotation More...
 
number getRotation ()
 get how much the object is rotated More...
 
number getSizeFriction ()
 get the friction applied to size changes (growing or shrinking) More...
 
number getSpeed ()
 get how fast the object is moving in pixels/sec More...
 
number getSpin ()
 get how fast the object is spinning in radians per second More...
 
number getSpinFriction ()
 get the friction applied toward spinning More...
 
Vector getVelocity ()
 get the vector that expresses magnitude and direction of the object's movement in pixels/sec More...
 
number getWidth ()
 get the width of the object More...
 
 grow (number factor, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 change size of the object by a factor over time More...
 
 move (Offset delta, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 move the object by a certain amount over time More...
 
 moveTo (Point where, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 move the object to a particular location over time More...
 
 removeAnimationHelper (IAnimationHelper helper)
 remove a specific animation helper More...
 
 resize (number deltaWidth, number deltaHeight, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 change the size of an object by a given amount over time More...
 
 resizeTo (number width, number height, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 resize the object to a specific size over time More...
 
 rotate (number radians, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 rotate the object by a specific amount over time More...
 
 rotateTo (number radiansRotation, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 rotate the object to face a particular direction over time More...
 
Animated setCenterOffset (Offset inCenterOffset)
 set the offset of the center point relative to the true center More...
 
Animated setFriction (number frictionCoefficient)
 set friction for movement, rotation and resizing all at once More...
 
Animated setHeight (number inHeight)
 set the object's height More...
 
Animated setLocation (Point inLocation)
 place the object at a particular location More...
 
Animated setMass (number inMass)
 set the object's mass, used when forces are applied More...
 
Animated setMoveFriction (number inMoveFriction)
 set the object's friction for movement More...
 
Animated setRotation (number inRotation)
 set the direction the object is facing in radians More...
 
Animated setSize (number width, number height)
 set the size of the object More...
 
Animated setSizeFriction (number inSizeFriction)
 set the friction applied for object resizing More...
 
Animated setSpeed (number inSpeed)
 set the speed the object is moving in its current direction of motion More...
 
Animated setSpin (number inSpin)
 set the rate at which the object is spinning, in radians/sec More...
 
Animated setSpinFriction (number inSpinFriction)
 set the friction the object faces for spinning More...
 
Animated setVelocity (Vector deltaPerSec)
 set the speed and direction the object is moving More...
 
Animated setVelocity (number deltaXPerSec, number deltaYPerSec)
 set the speed and direction the object is moving More...
 
Animated setVelocityInRadians (number speed, number direction)
 set the speed and direction the object is moving More...
 
Animated setWidth (number inWidth)
 set the width of the object More...
 
 startGrowing (number amountPerSecond)
 set the growth rate of the object in pixels/sec More...
 
 startStretching (number widthPerSecond, number heightPerSecond)
 set the growth rate of the object in pixels/sec, with varied rates for width and height More...
 
 stopAllForces ()
 remove all forces that were acting on the object (except friction) More...
 
 stopGrowing ()
 stop any size change More...
 
 stopMoving ()
 stop any movement the object was doing (except spinning) More...
 
 stopSpinning ()
 stop any spinning the object was doing More...
 
 stopStretching ()
 stop any stretching the object was doing More...
 
 stretch (number widthFactor, number heightFactor, int msDuration=duration_Instantaneous, int easing=easeInOutQuad)
 change the dimensions of the object over time More...
 
Animated wait (int msDuration)
 wait before beginning the next animation call that operates over time More...
 

Detailed Description

something that can be automatically moved, spun or resized over time.

Note
API Stability: 2 - Unstable. The API is in the process of settling, but has not yet had sufficient real-world testing to be considered stable. Backwards-compatibility will be maintained if reasonable.

It has no drawing capabilities, so it is not intended to be used directly in most cases, but rather as a base class for items that can be animated. It could be used on a server to drive animation that is rendered on the client.

See Also
Sprite
SpriteLayer

Member Function Documentation

accelerate ( number  deltaSpeed,
int  msDuration = duration_Instantaneous,
int  easing = linearTween 
)

change the object's speed over time

Change the speed of an object in the current direction of motion.

Honors delay given by wait()

accelerateTo ( number  speed,
int  msDuration = duration_Instantaneous,
int  easing = linearTween 
)

change the object's speed to a particular value over time

Honors delay given by wait()

addAnimationHelper ( IAnimationHelper  helper)

setup a helper to handle custom animation

See Also
IAnimationHelper
animate ( int  msElapsed)

animate based on the passage of time

Returns
true if anything (position, size, movement, etc...) changed
applyForce ( Vector  force,
int  msDuration = duration_Instantaneous 
)

apply a force to the object over time

Honors delay given by wait()

applyTorque ( number  forceSpin,
int  msDuration = duration_Instantaneous 
)

apply torque to the object over time

Honors delay given by wait()

changeCenter ( Offset  offset,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

shift the center point of the object over time

Honors delay given by wait()

changeCenterTo ( Offset  offset,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

shift the center point of the object to a particular offset from true center over time

Honors delay given by wait().

clearAnimationHelpers ( )

remove all previously added animation helpers

See Also
addAnimationHelper
getBoundingBox ( )

get the rectangle that completely encloses the object

getCenterOffset ( )

get the current offset of the center relative to the true center point

getHeight ( )

get height of the object

getLocation ( )

get the position of the object

getMass ( )

get the mass of the object

getMoveFriction ( )

get the amount of friction for movement

getMovementDirectionInRadians ( )

get the direction the object is moving

getRotatedBounds ( )

get the bounds with rotation

Returns
RotatedRect
getRotation ( )

get how much the object is rotated

getSizeFriction ( )

get the friction applied to size changes (growing or shrinking)

getSpeed ( )

get how fast the object is moving in pixels/sec

getSpin ( )

get how fast the object is spinning in radians per second

getSpinFriction ( )

get the friction applied toward spinning

getVelocity ( )

get the vector that expresses magnitude and direction of the object's movement in pixels/sec

getWidth ( )

get the width of the object

grow ( number  factor,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

change size of the object by a factor over time

If factor is greater than 1.0, the object will grow, if less than 1.0, the object will shrink.

Honors delay given by wait()

move ( Offset  delta,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

move the object by a certain amount over time

Honors delay given by wait()

myAnimated.wait(10).move(offset); // waits 10 ms before move

myAnimated.move(offset); // move immediately
moveTo ( Point  where,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

move the object to a particular location over time

Honors delay given by wait()

myAnimated.wait(10).moveTo(p); // waits 10 ms before move

myAnimated.moveTo(p); // move immediately
removeAnimationHelper ( IAnimationHelper  helper)

remove a specific animation helper

See Also
addAnimationHelper
resize ( number  deltaWidth,
number  deltaHeight,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

change the size of an object by a given amount over time

Honors delay given by wait()

resizeTo ( number  width,
number  height,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

resize the object to a specific size over time

Honors delay given by wait()

rotate ( number  radians,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

rotate the object by a specific amount over time

Honors delay given by wait()

rotateTo ( number  radiansRotation,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

rotate the object to face a particular direction over time

Honors delay given by wait()

setCenterOffset ( Offset  inCenterOffset)

set the offset of the center point relative to the true center

setFriction ( number  frictionCoefficient)

set friction for movement, rotation and resizing all at once

setHeight ( number  inHeight)

set the object's height

setLocation ( Point  inLocation)

place the object at a particular location

setMass ( number  inMass)

set the object's mass, used when forces are applied

setMoveFriction ( number  inMoveFriction)

set the object's friction for movement

setRotation ( number  inRotation)

set the direction the object is facing in radians

setSize ( number  width,
number  height 
)

set the size of the object

setSizeFriction ( number  inSizeFriction)

set the friction applied for object resizing

setSpeed ( number  inSpeed)

set the speed the object is moving in its current direction of motion

setSpin ( number  inSpin)

set the rate at which the object is spinning, in radians/sec

setSpinFriction ( number  inSpinFriction)

set the friction the object faces for spinning

setVelocity ( Vector  deltaPerSec)

set the speed and direction the object is moving

setVelocity ( number  deltaXPerSec,
number  deltaYPerSec 
)

set the speed and direction the object is moving

setVelocityInRadians ( number  speed,
number  direction 
)

set the speed and direction the object is moving

setWidth ( number  inWidth)

set the width of the object

startGrowing ( number  amountPerSecond)

set the growth rate of the object in pixels/sec

startStretching ( number  widthPerSecond,
number  heightPerSecond 
)

set the growth rate of the object in pixels/sec, with varied rates for width and height

stopAllForces ( )

remove all forces that were acting on the object (except friction)

stopGrowing ( )

stop any size change

See Also
startGrowing
stopMoving ( )

stop any movement the object was doing (except spinning)

stopSpinning ( )

stop any spinning the object was doing

stopStretching ( )

stop any stretching the object was doing

stretch ( number  widthFactor,
number  heightFactor,
int  msDuration = duration_Instantaneous,
int  easing = easeInOutQuad 
)

change the dimensions of the object over time

Honors delay given by wait()

wait ( int  msDuration)

wait before beginning the next animation call that operates over time

Only applies to the next call, and only applies to calls where a duration can be passed in

Works with: move(), moveTo(), accelerateTo(), resize(), stretch(), grow(), resizeTo(), rotate(), rotateTo(), changeCenter(), changeCenterTo(), applyForce(), applyTorque(),

User Comments