Class MoviePlayer

java.lang.Object
tripleplay.flump.MoviePlayer
All Implemented Interfaces:
AutoCloseable, react.Closeable

public class MoviePlayer extends Object implements react.Closeable
A convenient controller to play though multiple different movies. Designed for characters and objects that have a separate Flump symbol for each of their animations, and need to switch between them.
  • Field Details

    • movie

      public final react.Value<Movie> movie
      The currently playing movie, if any.
  • Constructor Details

  • Method Details

    • movie

      public Movie movie()
    • setLibrary

      public void setLibrary(Library lib)
      Sets the library all further movies we load will come from.
    • layer

      public Layer layer()
      The layer the movies are placed on.
    • looping

      public boolean looping()
      Whether the current movie is being looped.
    • play

      public MoviePlayer play(String name, boolean restart)
      Shows a movie that plays once. When it completes, the last looping movie is returned to. It is an error to call this without starting a loop() first.
      Parameters:
      name - The symbol name of the movie to play.
      restart - If this movie is already being played, whether it will restart it from the beginning. Defaults to true.
      Returns:
      This instance, for chaining.
    • play

      public MoviePlayer play(String name)
    • loop

      public MoviePlayer loop(String name, boolean restart)
      Shows a movie that loops forever.
      Parameters:
      name - The symbol name of the movie to loop.
      restart - If this movie is already being looped, whether it will restart it from the beginning. Defaults to true.
      Returns:
      This instance, for chaining.
    • loop

      public MoviePlayer loop(String name)
    • animate

      public Animation animate(String name)
      Creates an Animation that plays a one-shot movie.
    • paint

      public void paint(Clock clock)
      Drives this movie player with the supplied clock.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface react.Closeable