Class Effect

  • All Implemented Interfaces:
    Renderable, Updatable

    public class Effect
    extends java.lang.Object
    implements Updatable, Renderable
    An animated graphical effect that can be played as part of a scene. In combination with the EffectManager, this allows declarative effects that can be played without having to manually update their logic and graphics every frame.

    The effect consists of a sprite that is animated according to a timeline. When the effect is created, a callback function is passed that is used to determine how the sprite should be modified based on the timeline's value. This callback is then called every frame, with the effect and the timeline's current value as the arguments.. Afterwards, the sprite is rendered.

    • Constructor Summary

      Constructors 
      Constructor Description
      Effect​(Animation anim, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,​java.lang.Float> callback)  
      Effect​(Image image, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,​java.lang.Float> callback)  
      Effect​(Sprite sprite, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,​java.lang.Float> callback)  
    • Constructor Detail

      • Effect

        public Effect​(Sprite sprite,
                      nl.colorize.util.animation.Timeline timeline,
                      java.util.function.BiConsumer<Effect,​java.lang.Float> callback)
      • Effect

        public Effect​(Animation anim,
                      nl.colorize.util.animation.Timeline timeline,
                      java.util.function.BiConsumer<Effect,​java.lang.Float> callback)
      • Effect

        public Effect​(Image image,
                      nl.colorize.util.animation.Timeline timeline,
                      java.util.function.BiConsumer<Effect,​java.lang.Float> callback)
    • Method Detail

      • getPosition

        public Point getPosition()
      • getTransform

        public Transform getTransform()
      • update

        public void update​(float deltaTime)
        Description copied from interface: Updatable
        Updates this object for the current frame.
        Specified by:
        update in interface Updatable
        Parameters:
        deltaTime - Elapsed time since the last frame, in seconds.
      • isCompleted

        public boolean isCompleted()