O1Library Docs
Fall 2026
Docs API

# Animation

o1.gui.Animation
See the Animation companion class
object Animation

This companion object of class Animation provides a couple of convenience methods (show, generate) for starting animations and an enumeration (AtEnd) for use with the class.

## Attributes

Companion
  class
Graph
Supertypes
  class Object
  trait Matchable
  class Any
Self type
  Animation.type

## Members list

### Type members

#### Classlikes

enum AtEnd extends Product, Serializable

The values of this enumeration each specify a different policy for what happens once an Animation reaches the last frame.

The values of this enumeration each specify a different policy for what happens once an Animation reaches the last frame.

## Attributes

Supertypes
  trait Enum
  trait Serializable
  trait Product
  trait Equals
  class Object
  trait Matchable
  class Any
  Show all

### Value members

#### Concrete methods

def generate(makeFrame: Int => Pic, numberOfFrames: Int = ..., frameRate: Double = ..., terminateOnClose: Boolean = ..., atEnd: AtEnd = ...): Animation

Uses a given function to generate an animation, then starts and returns that animation.

Uses a given function to generate an animation, then starts and returns that animation.

## Parameters

atEnd

  what should happen once the animation reaches the final Pic

frameRate

  a target speed (in Pics per second), which the `Animation` will roughly observe if possible

makeFrame

  a function that generates the frames of the animation: it takes a frame number (>= 0) and returns the corresponding Pic

numberOfFrames

  the number of frames in the animation; the numbers `0 &lt;= n &lt; numberOfFrames` get passed to `makeFrame` to generate the animation

terminateOnClose

  whether the entire application should exit when the animation window is closed

## Attributes

Returns

  the running animation

def show(frames: Iterable[Pic], frameRate: Double = ..., terminateOnClose: Boolean = ..., atEnd: AtEnd = ...): Animation

Creates and immediately starts an Animation as specified by the parameters.

Creates and immediately starts an Animation as specified by the parameters.

## Parameters

atEnd

  what should happen once the animation reaches the final Pic

frameRate

  a target speed (in Pics per second), which the `Animation` will roughly observe if possible

frames

  the Pics that the animation consists of, in order; they should be identical in size

terminateOnClose

  whether the entire application should exit when the animation window is closed

## Attributes

Returns

  the running animation