+++ /dev/null
-package com.badlogic.gdx.scenes.scene2d.actions;\r
-\r
-import com.badlogic.gdx.scenes.scene2d.Action;\r
-import com.badlogic.gdx.scenes.scene2d.Actor;\r
-import com.badlogic.gdx.utils.Pool;\r
-import com.badlogic.gdx.utils.Pool.PoolObjectFactory;\r
-\r
-public class Forever implements Action \r
-{\r
- static final Pool<Forever> pool = new Pool<Forever>( new PoolObjectFactory<Forever>() {\r
- @Override\r
- public Forever createObject() \r
- {\r
- return new Forever( );\r
- }\r
- }, 100 );\r
- \r
- private Action action;\r
- private Actor target;\r
- \r
- public static Forever $( Action action )\r
- {\r
- Forever forever = pool.newObject();\r
- forever.action = action;\r
- return forever;\r
- }\r
-\r
- @Override\r
- public void setTarget(Actor actor) \r
- {\r
- this.target = actor;\r
- action.setTarget( actor );\r
- }\r
-\r
- @Override\r
- public void act(float delta) \r
- {\r
- action.act( delta );\r
- if( action.isDone() )\r
- action.setTarget( target );\r
- \r
- }\r
-\r
- @Override\r
- public boolean isDone() {\r
- return false;\r
- }\r
-}\r
import com.badlogic.gdx.scenes.scene2d.actions.FadeOut;\r
import com.badlogic.gdx.scenes.scene2d.actions.MoveTo;\r
import com.badlogic.gdx.scenes.scene2d.actions.Parallel;\r
+import com.badlogic.gdx.scenes.scene2d.actions.RotateBy;\r
import com.badlogic.gdx.scenes.scene2d.actions.RotateTo;\r
import com.badlogic.gdx.scenes.scene2d.actions.ScaleTo;\r
import com.badlogic.gdx.scenes.scene2d.actions.Sequence;\r
\r
Image img1 = new Image( "image1", new TextureRegion( badlogic, 0, 0, 256, 256 ) );\r
img1.width = img1.height = 64; img1.originX = img1.originY = 32;\r
- ui.addActor( img1 );\r
img1.action( Sequence.$( \r
- FadeOut.$(0),\r
+ FadeOut.$(1),\r
FadeIn.$(1),\r
Delay.$( MoveTo.$( 100, 100, 1 ), 2 ),\r
ScaleTo.$( 0.5f, 0.5f, 1 ),\r
, 1 )\r
)\r
);\r
+ ui.addActor( img1 );\r
\r
- Button button = new Button( "button", atlas.getRegion( "button" ), atlas.getRegion( "buttonDown" ) ); \r
+ Button button = new Button( "button", atlas.getRegion( "button" ), atlas.getRegion( "buttonDown" ) );\r
+ button.action( RotateBy.$( 360, 4 ) );\r
ui.addActor( button );\r
\r
LinearGroup linear = new LinearGroup( "linear", 64, 32 * 3, LinearGroupLayout.Vertical );\r
linear.addActor( new Button( "blend", atlas.getRegion( "blend" ), atlas.getRegion( "blendDown" ) ) );\r
linear.addActor( new Button( "scale", atlas.getRegion( "scale" ), atlas.getRegion( "scaleDown" ) ) );\r
linear.addActor( new Button( "rotate", atlas.getRegion( "rotate" ), atlas.getRegion( "rotateDown" ) ) );\r
+ linear.action( Parallel.$( ScaleTo.$( 1, 1, 2 ), RotateTo.$( 720, 2 ) ) );\r
ui.addActor( linear );\r
- linear.action( Parallel.$( ScaleTo.$( 1, 1, 2 ), RotateTo.$( 720, 2 ) ) ); \r
-\r
\r
LinearGroup linearh = new LinearGroup( "linearh", 64 * 3, 32, LinearGroupLayout.Horizontal );\r
linearh.x = 500; linearh.y = 10;\r
linearh.addActor( new Button( "blendh", atlas.getRegion( "blend" ), atlas.getRegion( "blendDown" ) ) );\r
linearh.addActor( new Button( "scaleh", atlas.getRegion( "scale" ), atlas.getRegion( "scaleDown" ) ) );\r
linearh.addActor( new Button( "rotateh", atlas.getRegion( "rotate" ), atlas.getRegion( "rotateDown" ) ) );\r
+ linearh.action( MoveTo.$(100, 10, 1.5f) );\r
ui.addActor( linearh ); \r
- linearh.action( MoveTo.$(100, 10, 1.5f) ); \r
-\r
\r
// Group.enableDebugging( "data/debug.png" );\r
}\r
ui.toStageCoordinates( x, y, point );\r
actor.clearActions();\r
actor.action( MoveTo.$( point.x, point.y, 2 ) );\r
- actor.action( RotateTo.$( actor.rotation + 90, 2 ) );\r
+ actor.action( RotateBy.$( 90, 2 ) );\r
if( actor.scaleX == 1.0f )\r
actor.action( ScaleTo.$( 0.5f, 0.5f, 2 ) );\r
else\r