libgdx API

com.badlogic.gdx.graphics.g3d
Class Animator

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.Animator
Direct Known Subclasses:
KeyframeAnimator, MD5Animator

public abstract class Animator
extends java.lang.Object

Abstract class for a single-track animation controller. Keeps track of the animation position and invokes interpolation on concrete classes.

Author:
Dave Clayton

Nested Class Summary
static class Animator.WrapMode
           
 
Field Summary
protected  float mAnimLen
           
protected  float mAnimPos
           
protected  Animation mCurrentAnim
           
protected  int mCurrentFrameIdx
           
protected  float mFrameDelta
           
protected  int mNextFrameIdx
           
protected  Animator.WrapMode mWrapMode
           
 
Constructor Summary
Animator()
           
 
Method Summary
 Animation getCurrentAnimation()
          Gets the currently playing Animation.
 Animator.WrapMode getCurrentWrapMode()
          Gets the current animation Animator.WrapMode.
protected abstract  void interpolate()
          Implementations should interpolate between the 'current' and 'next' frames of animation.
 void setAnimation(Animation anim, Animator.WrapMode mode)
          Sets the currently playing Animation.
protected abstract  void setInterpolationFrames()
          Implementations should set the 'current' and 'next' frames of animation that will be interpolated.
 void update(float dt)
          Updates the controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mAnimPos

protected float mAnimPos

mAnimLen

protected float mAnimLen

mWrapMode

protected Animator.WrapMode mWrapMode

mCurrentFrameIdx

protected int mCurrentFrameIdx

mNextFrameIdx

protected int mNextFrameIdx

mFrameDelta

protected float mFrameDelta

mCurrentAnim

protected Animation mCurrentAnim
Constructor Detail

Animator

public Animator()
Method Detail

setAnimation

public void setAnimation(Animation anim,
                         Animator.WrapMode mode)
Sets the currently playing Animation.

Parameters:
anim - The animation to play.
mode - The animation's Animator.WrapMode.

getCurrentAnimation

public Animation getCurrentAnimation()
Gets the currently playing Animation.

Returns:
the current animation.

getCurrentWrapMode

public Animator.WrapMode getCurrentWrapMode()
Gets the current animation Animator.WrapMode.

Returns:
the current wrapmode.

update

public void update(float dt)
Updates the controller.

Parameters:
dt - Delta time since last frame.

setInterpolationFrames

protected abstract void setInterpolationFrames()
Implementations should set the 'current' and 'next' frames of animation that will be interpolated.


interpolate

protected abstract void interpolate()
Implementations should interpolate between the 'current' and 'next' frames of animation.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)