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

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