return "Various Animations";
}
@Override protected Group createIface () {
// demo a repeating animation
CanvasImage image = graphics().createImage(100, 100);
image.canvas().setFillColor(0xFFFFCC99).fillCircle(50, 50, 50);
ImageLayer circle = graphics().createImageLayer(image);
float width = graphics().width();
anim.addAt(layer, circle, 50, 100).then().
repeat(circle).tweenX(circle).to(width-150).in(1000).easeInOut().then().
tweenX(circle).to(50).in(1000).easeInOut();
// demo the shake animation
final ImageLayer click = StyledText.span("Click to Shake", STYLE).toLayer();
click.addListener(new Pointer.Adapter() {
@Override public void onPointerStart (Pointer.Event event) {
if (_shaker != null) _shaker.complete();
else _shaker = anim.shake(click).bounds(-3, 3, -3, 0).cycleTime(25, 25).in(1000).
then().action(_clear).handle();
}
protected final Runnable _clear = new Runnable() {
public void run () { _shaker = null; }};
protected Animation.Handle _shaker;
});
layer.addAt(click, (width-click.width())/2, 275);
// demo animation groups
CanvasImage ball = graphics().createImage(40, 40);
ball.canvas().setFillColor(0xFF99CCFF).fillCircle(20, 20, 20);
ImageLayer[] balls = new ImageLayer[6];
for (int ii = 0; ii < balls.length; ii++) {
layer.addAt(balls[ii] = graphics().createImageLayer(ball), 170+ii*50, 350);
}
anim.repeat(layer).add(dropBalls(balls, 0, 1)).then().
add(dropBalls(balls, 1, 2)).then().
add(dropBalls(balls, 3, 3));
// test barrier delay
CanvasImage sqimg = graphics().createImage(50, 50);
sqimg.canvas().setFillColor(0xFF99CCFF).fillRect(0, 0, 50, 50);
final ImageLayer square = graphics().createImageLayer(sqimg);
square.setOrigin(25, 25);
layer.addAt(square, 50, 300);
square.addListener(new Pointer.Adapter() {
@Override public void onPointerStart (Pointer.Event event) {