com.threerings.opengl.model
Class Animation

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.opengl.model.Animation
All Implemented Interfaces:
ConfigUpdateListener<AnimationConfig>, Scope, ScopeUpdateListener

public class Animation
extends SimpleScope
implements ConfigUpdateListener<AnimationConfig>

An animation for an Articulated model.


Nested Class Summary
static class Animation.Implementation
          The actual animation implementation.
static class Animation.Imported
          An imported implementation.
static class Animation.Procedural
          A procedural implementation.
static class Animation.Sequential
          A sequential implementation.
 
Field Summary
static Animation[] EMPTY_ARRAY
          An empty array of animations.
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
Animation(GlContext ctx, Scope parentScope)
          Creates a new animation.
 
Method Summary
 void addObserver(AnimationObserver observer)
          Adds an observer to this animation.
 void blendTransforms(int update)
          Blends in the influence of this animation.
 void configUpdated(ConfigEvent<AnimationConfig> event)
          Called when a configuration has been updated.
 void dispose()
          Releases the resources associated with this scope.
 String getName()
          Returns the name of the animation.
 int getPriority()
          Returns the priority of this animation.
 String getScopeName()
          Returns the name of this scope for purposes of qualification.
 float getSpeed()
          Returns the speed at which the animation is being played.
 boolean hasCompleted()
          Checks whether the animation has just completed, and thus should be removed from the playing list after a final update has been performed.
 boolean isPlaying()
          Determines whether this animation is playing.
 void removeObserver(AnimationObserver observer)
          Removes an observer from this animation.
 void scopeUpdated(ScopeEvent event)
          Called when the scope has been updated.
 void setConfig(String name, AnimationConfig config)
          Sets the configuration of this animation.
 void setConfig(String name, ConfigReference<AnimationConfig> ref)
          Sets the configuration of this animation.
 void setConfig(String name, String config)
          Sets the configuration of this animation.
 void setConfig(String name, String config, String firstKey, Object firstValue, Object... otherArgs)
          Sets the configuration of this animation.
 void setSpeed(float speed)
          Sets the speed at which to play the animation.
 void start()
          Starts playing this animation.
 void stop()
          Stops playing this animation.
 void stop(float blendOut)
          Stops playing this animation, blending it out over the specified interval (as opposed to its default interval).
 boolean tick(float elapsed)
          Updates this animation based on the elapsed time in seconds.
 String toString()
           
 void updateTransforms()
          Updates the transforms directly from this animation.
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, get, getParentScope, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final Animation[] EMPTY_ARRAY
An empty array of animations.

Constructor Detail

Animation

public Animation(GlContext ctx,
                 Scope parentScope)
Creates a new animation.

Method Detail

setConfig

public void setConfig(String name,
                      String config)
Sets the configuration of this animation.


setConfig

public void setConfig(String name,
                      ConfigReference<AnimationConfig> ref)
Sets the configuration of this animation.


setConfig

public void setConfig(String name,
                      String config,
                      String firstKey,
                      Object firstValue,
                      Object... otherArgs)
Sets the configuration of this animation.


setConfig

public void setConfig(String name,
                      AnimationConfig config)
Sets the configuration of this animation.


getName

public String getName()
Returns the name of the animation.


setSpeed

public void setSpeed(float speed)
Sets the speed at which to play the animation.


getSpeed

public float getSpeed()
Returns the speed at which the animation is being played.


start

public void start()
Starts playing this animation.


stop

public void stop()
Stops playing this animation.


stop

public void stop(float blendOut)
Stops playing this animation, blending it out over the specified interval (as opposed to its default interval).


isPlaying

public boolean isPlaying()
Determines whether this animation is playing.


addObserver

public void addObserver(AnimationObserver observer)
Adds an observer to this animation.


removeObserver

public void removeObserver(AnimationObserver observer)
Removes an observer from this animation.


getPriority

public int getPriority()
Returns the priority of this animation.


tick

public boolean tick(float elapsed)
Updates this animation based on the elapsed time in seconds.

Returns:
true if the animation has completed.

hasCompleted

public boolean hasCompleted()
Checks whether the animation has just completed, and thus should be removed from the playing list after a final update has been performed.


updateTransforms

public void updateTransforms()
Updates the transforms directly from this animation.


blendTransforms

public void blendTransforms(int update)
Blends in the influence of this animation.

Parameters:
update - the current value of the update counter (used to determine which nodes have been touched on this update).

configUpdated

public void configUpdated(ConfigEvent<AnimationConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<AnimationConfig>

getScopeName

public String getScopeName()
Description copied from interface: Scope
Returns the name of this scope for purposes of qualification. Can return null if qualified symbols cannot specifically address this scope.

Specified by:
getScopeName in interface Scope
Overrides:
getScopeName in class SimpleScope

scopeUpdated

public void scopeUpdated(ScopeEvent event)
Description copied from interface: ScopeUpdateListener
Called when the scope has been updated.

Specified by:
scopeUpdated in interface ScopeUpdateListener
Overrides:
scopeUpdated in class SimpleScope

dispose

public void dispose()
Description copied from class: SimpleScope
Releases the resources associated with this scope.

Overrides:
dispose in class SimpleScope

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.