sequence

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sequence runs a list of timeline steps in order, with lifetime bound to an owner node. Steps are composed via Wait / Do / Parallel / Loop.

sequence.Run(p.AsNode(),
    sequence.Do(func() { p.SetVisible(false) }),
    sequence.Wait(0.4),
    sequence.Do(func() { p.SetVisible(true) }),
    sequence.Wait(0.4),
    sequence.Do(func() { p.Free() }),
)

Runs on the engine's main thread via timing.After's Timer-node machinery — no goroutines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(owner Node.Instance, steps ...Step)

Run starts the sequence under owner. When owner exits the tree, the sequence cancels — any pending step doesn't fire.

Types

type Step

type Step func(owner Node.Instance, next func())

Step is one entry in a sequence. Construct with Wait, Do, WaitUntil, Parallel, or Loop.

func Do

func Do(fn func()) Step

Do runs fn synchronously, then continues to the next step. Use for one-shot side effects between Waits — flashing, freeing, signal emits.

func Loop

func Loop(n int, steps ...Step) Step

Loop repeats steps n times (or forever if n <= 0). Between iterations there's no implicit delay — chain a Wait inside steps if you want one.

func Parallel

func Parallel(steps ...Step) Step

Parallel fans out to substeps simultaneously and continues to the next outer step once *every* substep has completed.

func Wait

func Wait(dt gd.Delta) Step

Wait inserts a delay of dt seconds. The next step runs after dt elapses (assuming owner is still in the tree).

func WaitUntil

func WaitUntil(cond func() bool) Step

WaitUntil polls cond every frame and continues to the next step when it returns true. Cheap polling; for state-driven branching prefer github.com/AveryLucas/gogogd/fsm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL