Vixen
02b45cc4
csharp
public record class SpriteAnimation

A sequence of a sheet's frames and the rate they are played at.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Indices into a sheet, not sprites. An animation is a playlist and the sheet is the library — so two animations sharing frames share integers, a re-cut sheet does not invalidate every clip that draws from it, and the whole thing serialises as a list of numbers.

⚠ Sampled, never stepped. FrameAt is a pure function of a time, so nothing here holds a playhead: rewinding is passing a smaller number, and two things playing the same clip out of step are two numbers rather than two copies. A stepped animation drifts with the frame rate it was stepped at, and the drift is the kind that only shows up on somebody else's machine.

Fields and properties (5)

  • public string Name

    What the clip is called.

  • public int[] Frames

    Which of the sheet's sprites it plays, in order.

  • public float FrameRate

    How many frames a second.

  • public SpriteWrap Wrap

    What happens after the last frame.

  • public float Duration

    How long one pass through the frames takes, in seconds.

Methods (3)

  • public int FrameAt(float time)

    Which of Frames is showing at a time.

  • public int SpriteAt(float time)

    Which of the sheet's sprites is showing at a time.

  • public Sprite? SpriteAt(SpriteSheet sheet, float time)

    Which of the sheet's sprites is showing, resolved against the sheet it names.

Used by (3)

  • SpriteTestsVixen.Rendering.Tests
  • TypeRegistrationVixen.Rendering
  • Vixen_Rendering_Sprites_SpriteAnimationSerializerVixen.Rendering