libgdx API

com.badlogic.gdx.scenes.scene2d.actions
Class ColorAction

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Action
      extended by com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
          extended by com.badlogic.gdx.scenes.scene2d.actions.ColorAction
All Implemented Interfaces:
Pool.Poolable

public class ColorAction
extends TemporalAction

Sets the actor's color (or a specified color), from the current to the new color. Note this action transitions from the color at the time the action starts to the specified color.

Author:
Nathan Sweet

Field Summary
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Action
actor
 
Constructor Summary
ColorAction()
           
 
Method Summary
protected  void begin()
          Called the first time TemporalAction.act(float) is called.
 Color getColor()
           
 Color getEndColor()
           
 void reset()
          Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused.
 void setColor(Color color)
          Sets the color to modify.
 void setEndColor(Color color)
          Sets the color to transition to.
protected  void update(float percent)
          Called each frame.
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
act, end, finish, getDuration, getInterpolation, getTime, isReverse, restart, setDuration, setInterpolation, setReverse, setTime
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Action
getActor, getPool, setActor, setPool, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorAction

public ColorAction()
Method Detail

begin

protected void begin()
Description copied from class: TemporalAction
Called the first time TemporalAction.act(float) is called. This is a good place to query the actor's starting state.

Overrides:
begin in class TemporalAction

update

protected void update(float percent)
Description copied from class: TemporalAction
Called each frame.

Specified by:
update in class TemporalAction
Parameters:
percent - The percentage of completion for this action, growing from 0 to 1 over the duration. If reversed, this will shrink from 1 to 0.

reset

public void reset()
Description copied from class: Action
Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused. State required to be set for every usage of this action or computed during the action does not need to be reset.

The default implementation calls Action.restart().

If a subclass has optional state, it must override this method, call super, and reset the optional state.

Specified by:
reset in interface Pool.Poolable
Overrides:
reset in class TemporalAction

getColor

public Color getColor()

setColor

public void setColor(Color color)
Sets the color to modify. If null (the default), the actor's color will be used.


getEndColor

public Color getEndColor()

setEndColor

public void setEndColor(Color color)
Sets the color to transition to. Required.


libgdx API

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