Class AnimationTimeline

java.lang.Object
dev.bouncingelf10.timelesslib.api.animation.AnimationTimeline

public class AnimationTimeline extends Object
  • Constructor Details

    • AnimationTimeline

      public AnimationTimeline(String timelineId)
  • Method Details

    • id

      public String id()
    • loop

      public AnimationTimeline loop(boolean enabled)
    • pingPong

      public AnimationTimeline pingPong(boolean enabled)
    • speed

      public AnimationTimeline speed(double speed)
    • defaultInterpolation

      public AnimationTimeline defaultInterpolation(Interpolation interpolation)
      Sets the default interpolation for the timeline.
      Note: Channels can override these settings and follow a hierarchy:
      AnimationTimeline > ChannelDouble > KeyframeDouble (same for Vec3)
    • defaultEasing

      public AnimationTimeline defaultEasing(Easing easing)
      Sets the default easing for the timeline.
      Note: Channels can override these settings and follow a hierarchy:
      AnimationTimeline > ChannelDouble > KeyframeDouble (same for Vec3)
    • onStart

      public AnimationTimeline onStart(Runnable callback)
      Adds a callback to be executed when the timeline starts playing.
      Parameters:
      callback - Callback to execute
    • onLoop

      public AnimationTimeline onLoop(Runnable callback)
      Adds a callback to be executed when the timeline loops.
      Parameters:
      callback - Callback to execute
    • onFinish

      public AnimationTimeline onFinish(Runnable callback)
      Adds a callback to be executed when the timeline finishes playing.
      Parameters:
      callback - Callback to execute
    • isPlaying

      public boolean isPlaying()
    • isFinished

      public boolean isFinished()
    • play

      public void play()
    • pause

      public void pause()
    • stop

      public void stop()
    • playOrReset

      public void playOrReset()
    • pauseOrUnpause

      public void pauseOrUnpause()
      Toggles between playing and paused.
    • seek

      public void seek(double seconds)
      Seeks to the specified time in seconds. Note: "Seeking" to a time means that the timeline will jump to that time instantly.
    • seek

      public void seek(Duration duration)
      Seeks to the specified duration. Note: "Seeking" to a time means that the timeline will jump to that time instantly.
    • channelDouble

      public ChannelDouble channelDouble(String name)
      Adds a new double channel to the timeline.
      Parameters:
      name - Channel name
      Returns:
      ChannelDouble
    • channelVec3

      public ChannelVec3 channelVec3(String name)
      Adds a new Vec3 channel to the timeline.
      Parameters:
      name - Channel name
      Returns:
      ChannelVec3
    • getDoubleChannels

      public Collection<ChannelDouble> getDoubleChannels()
    • getVec3Channels

      public Collection<ChannelVec3> getVec3Channels()
    • update

      public void update(double deltaSeconds)
      You don't need to call this. Its taken care of by the AnimationManager.
    • getDurationSeconds

      public double getDurationSeconds()
    • setTimeSource

      public AnimationTimeline setTimeSource(TimeSource source)
      Sets the default TimeSource for the timeline.
      Note: Channels can override these settings and follow a hierarchy:
      AnimationTimeline > ChannelDouble > KeyframeDouble (same for Vec3)
    • bindDouble

      public AnimationTimeline bindDouble(String channelName, Consumer<Double> consumer)
      Binds a double consumer to the specified channel.
      Normally you should call this in the channel itself ChannelDouble.bind(Consumer) and I advise you to not use this method.
    • bindVec3

      public AnimationTimeline bindVec3(String channelName, Consumer<net.minecraft.world.phys.Vec3> consumer)
      Binds a Vec3 consumer to the specified channel.
      Normally you should call this in the channel itself ChannelVec3.bind(Consumer) and I advise you to not use this method.