Class AnimBuilder

java.lang.Object
tripleplay.anim.AnimBuilder
Direct Known Subclasses:
Animator, AnimGroup

public abstract class AnimBuilder extends Object
Provides a fluent interface for building single chains of animations. See Animator for a concrete entry point.
  • Constructor Details

    • AnimBuilder

      public AnimBuilder()
  • Method Details

    • add

      public abstract <T extends Animation> T add(T anim)
      Registers an animation with this builder. If this is the root animator, it will be started on the next frame and continue until cancelled or it reports that it has completed. If this is an animator returned from Animation.then() then the queued animation will be started when the animation on which then was called has completed.
    • tweenTranslation

      public Animation.Two tweenTranslation(Layer layer)
      Starts a tween on the supplied layer's x/y-translation.
    • tweenXY

      public Animation.Two tweenXY(Layer layer)
      Starts a tween on the supplied layer's x/y-translation.
    • tweenX

      public Animation.One tweenX(Layer layer)
      Starts a tween on the supplied layer's x-translation.
    • tweenY

      public Animation.One tweenY(Layer layer)
      Starts a tween on the supplied layer's y-translation.
    • tweenOrigin

      public Animation.Two tweenOrigin(Layer layer)
      Starts a tween on the supplied layer's origin.
    • tweenRotation

      public Animation.One tweenRotation(Layer layer)
      Starts a tween on the supplied layer's rotation.
    • tweenScale

      public Animation.One tweenScale(Layer layer)
      Starts a tween on the supplied layer's x/y-scale.
    • tweenScaleXY

      public Animation.Two tweenScaleXY(Layer layer)
      Starts a tween on the supplied layer's x/y-scale.
    • tweenScaleX

      public Animation.One tweenScaleX(Layer layer)
      Starts a tween on the supplied layer's x-scale.
    • tweenScaleY

      public Animation.One tweenScaleY(Layer layer)
      Starts a tween on the supplied layer's y-scale.
    • tweenAlpha

      public Animation.One tweenAlpha(Layer layer)
      Starts a tween on the supplied layer's transparency.
    • tween

      public Animation.One tween(Animation.Value value)
      Starts a tween using the supplied custom value. Animation.Value.initial() will be used (if needed) to obtain the initial value before the tween begins. Animation.Value.set(float) will be called each time the tween is updated with the intermediate values.
    • tween

      public Animation.Two tween(Animation.XYValue value)
      Starts a tween using the supplied custom X/Y value.
    • flipbook

      public Animation.Flip flipbook(ImageLayer layer, Flipbook book)
      Starts a flipbook animation that displays in layer. Note that the image layer in question will have its translation adjusted based on the offset of the current frame. Thus it should be placed into a GroupLayer if it is to be positioned and animated separately.
    • flipbook

      public Animation.Flip flipbook(GroupLayer box, Flipbook book)
      Starts a flipbook animation in a new image layer which is created and added to box. When the flipbook animation is complete, the newly created image layer will not be disposed automatically. This allows the animation to be repeated, if desired. The caller must dispose eventually the image layer, or more likely, dispose box which will cause the created image layer to be disposed.
    • flipbookAt

      public Animation flipbookAt(GroupLayer parent, float x, float y, Flipbook book)
      Starts a flipbook animation that displays the supplied book at the specified position in the supplied parent. The intermediate layers created to display the flipbook animation will be disposed on completion.
    • flipbookAt

      public Animation flipbookAt(GroupLayer parent, pythagoras.f.XY pos, Flipbook book)
      Starts a flipbook animation that displays the supplied book at the specified position in the supplied parent. The intermediate layers created to display the flipbook animation will be disposed on completion.
    • shake

      public Animation.Shake shake(Layer layer)
      Creates a shake animation on the specified layer.
    • delay

      public Animation.Delay delay(float duration)
      Creates an animation that delays for the specified duration in milliseconds.
    • repeat

      public AnimBuilder repeat(Layer layer)
      Returns a builder which can be used to construct an animation that will be repeated until the supplied layer has been removed from its parent. The layer must be added to a parent before the next frame (if it's not already), or the cancellation will trigger immediately.
    • action

      public Animation.Action action(Runnable action)
      Creates an animation that executes the supplied runnable and immediately completes.
    • add

      public Animation.Action add(GroupLayer parent, Layer child)
      Adds the supplied child to the supplied parent. This is generally done as the beginning of a chain of animations, which itself may be delayed or subject to animation barriers.
    • addAt

      public Animation.Action addAt(GroupLayer parent, Layer child, pythagoras.f.XY pos)
      Adds the supplied child to the supplied parent at the specified translation. This is generally done as the beginning of a chain of animations, which itself may be delayed or subject to animation barriers.
    • addAt

      public Animation.Action addAt(GroupLayer parent, Layer child, float x, float y)
      Adds the supplied child to the supplied parent at the specified translation. This is generally done as the beginning of a chain of animations, which itself may be delayed or subject to animation barriers.
    • reparent

      public Animation.Action reparent(GroupLayer newParent, Layer child)
      Reparents the supplied child to the supplied new parent. This involves translating the child's current coordinates to screen coordinates, moving it to its new parent layer and translating its coordinates into the coordinate space of the new parent. Thus the child does not change screen position, even though its coordinates relative to its parent will most likely have changed.
    • dispose

      public Animation.Action dispose(react.Closeable dable)
      Disposes the specified disposable.
    • setDepth

      public Animation.Action setDepth(Layer layer, float depth)
      Sets the specified layer's depth to the specified value.
    • setVisible

      public Animation.Action setVisible(Layer layer, boolean visible)
      Sets the specified layer to visible or not.
    • play

      public Animation.Action play(Playable sound)
      Plays the supplied clip or loop.
    • stop

      public Animation.Action stop(Playable sound)
      Stops the supplied clip or loop.
    • play

      public Animation.Action play(Sound sound)
      Plays the supplied sound.
    • tweenVolume

      public Animation.One tweenVolume(Playable sound)
      Tweens the volume of the supplied playable. Note, this does not play or stop the sound, those must be enacted separately.
    • tweenVolume

      public Animation.One tweenVolume(Sound sound)
      Tweens the volume of the supplied sound. Useful for fade-ins and fade-outs. Note, this does not play or stop the sound, those must be enacted separately.
    • stop

      public Animation.Action stop(Sound sound)
      Stops the supplied sound from playing.
    • emit

      public <T> Animation.Action emit(react.Signal<T> signal, T value)
      Emits value on signal.
    • setValue

      public <T> Animation.Action setValue(react.Value<T> value, T newValue)
      Sets a value to the supplied constant.
    • increment

      public Animation.Action increment(react.Value<Integer> value, int amount)
      Increments (or decrements if amount is negative} an int value.