Aego Русский

aego/action

Build the action in one frame: Sequence or Parallel, then Then, ThenTimer, ThenAction and Wait. It starts at the next tween update; yield it to wait for the end. In a project, attach it to a node with a Sprite Renderer. See Actions.

On this page

Example

package demo

import (
    "aego/action"
    "aego/curve"
    "aego/log"
    "aego/timer"
    "aego/tween"
)

script Door {
    func Ready() {
        start Open()
    }

    func Open() coroutine {
        shake := action.Parallel().
            Then(tween.ToFloat(node, "transform.rotation", 0.1, 0.1, curve.OutQuad).PingPong(4)).
            ThenTimer(timer.Start(0.3))
        a := action.Sequence().
            ThenAction(shake).
            Wait(0.2).
            Then(tween.Position(node, Vec2{0, -2}, 0.5, curve.InOutCubic))
        a.Completed.Connect(OnOpened)
        log.Info("opening, running: " + string(a.Running()))
        yield a
        log.Info("door at y=" + string(node.Position().Y) + ", done: " + string(a.Done()))
    }

    func OnOpened(finished bool) {
        log.Info("action finished: " + string(finished))
    }
}

Functions

ActionAction runs tweens, timers and other actions one after another or together; yield a waits until it ends.
Parallel() Handle<aego/action.Action>Makes an action that runs all its steps at once and ends after the last one.
Sequence() Handle<aego/action.Action>Makes an action that runs its steps one after another, starting at the next tween update.

Parallel function

func Parallel() Handle<aego/action.Action>

Makes an action that runs all its steps at once and ends after the last one.

See the module example for this function in use.

Sequence function

func Sequence() Handle<aego/action.Action>

Makes an action that runs its steps one after another, starting at the next tween update.

Example

yield action.Sequence().Then(tween.Position(node, Vec2{4, 0}, 0.5, curve.OutCubic)).Wait(0.2).Then(tween.ToFloat(node, "SpriteRenderer.Tint.a", 0, 0.3, curve.Linear))