CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::ui::anim::CanvasAnimator Class Reference

Fixed-slot tween engine animating element offsets (plus a blink convenience that toggles visibility). More...

#include <CanvasAnim.h>

Public Member Functions

uint32_t start (const TweenConfig &cfg, uint32_t nowMs)
 Start an offset tween. A FROM_CURRENT start captures the live offset lazily on the first advance() after the delay elapses.
uint32_t blink (uint32_t elemId, uint16_t periodMs, uint16_t count, uint32_t doneActionId, uint32_t nowMs)
 Start a visibility blink: count on/off cycles of periodMs per phase, ending visible. Occupies one tween slot.
bool cancel (uint32_t handle)
 Cancel a tween and its chain (handle 0 = all). No completion fires.
void cancelForElem (uint32_t elemId)
 Silently cancel every tween bound to an element (element was removed).
bool pause (uint32_t handle, bool paused, uint32_t nowMs)
int8_t state (uint32_t handle) const
uint8_t activeCount () const
 Number of live slots (delayed, chained, running or paused).
void shiftTime (uint32_t deltaMs)
 Shift every time base forward (view was paused for deltaMs).
void reset ()
 Drop all slots without firing completions (teardown).
bool advance (uint32_t nowMs, AnimTarget &target, Completion *done, uint8_t doneCap, uint8_t *doneCount)
 Advance all tweens to nowMs, applying offsets/visibility.

Static Public Attributes

static constexpr uint8_t MAX_TWEENS = 16
static constexpr uint16_t MAX_DURATION_MS = 60000

Detailed Description

Fixed-slot tween engine animating element offsets (plus a blink convenience that toggles visibility).

Handles are host-assigned, non-zero and unique until the slot is recycled after completion/cancel. Chained tweens (startAfter) wait for their predecessor; cancelling a predecessor silently cancels its whole chain.

Definition at line 117 of file CanvasAnim.h.

Member Function Documentation

◆ activeCount()

uint8_t cdc::ui::anim::CanvasAnimator::activeCount ( ) const

Number of live slots (delayed, chained, running or paused).

Definition at line 225 of file CanvasAnim.cpp.

◆ advance()

bool cdc::ui::anim::CanvasAnimator::advance ( uint32_t nowMs,
AnimTarget & target,
Completion * done,
uint8_t doneCap,
uint8_t * doneCount )

Advance all tweens to nowMs, applying offsets/visibility.

Parameters
doneOut array for finished tweens (completions with a doneActionId only).
doneCapCapacity of done.
doneCountOut: number of entries written.
Returns
true when any element offset or visibility changed.

Definition at line 342 of file CanvasAnim.cpp.

◆ blink()

uint32_t cdc::ui::anim::CanvasAnimator::blink ( uint32_t elemId,
uint16_t periodMs,
uint16_t count,
uint32_t doneActionId,
uint32_t nowMs )

Start a visibility blink: count on/off cycles of periodMs per phase, ending visible. Occupies one tween slot.

Definition at line 148 of file CanvasAnim.cpp.

References cdc::ui::anim::REPEAT_FOREVER.

◆ cancel()

bool cdc::ui::anim::CanvasAnimator::cancel ( uint32_t handle)

Cancel a tween and its chain (handle 0 = all). No completion fires.

Definition at line 177 of file CanvasAnim.cpp.

◆ cancelForElem()

void cdc::ui::anim::CanvasAnimator::cancelForElem ( uint32_t elemId)

Silently cancel every tween bound to an element (element was removed).

Definition at line 193 of file CanvasAnim.cpp.

◆ pause()

bool cdc::ui::anim::CanvasAnimator::pause ( uint32_t handle,
bool paused,
uint32_t nowMs )

Definition at line 203 of file CanvasAnim.cpp.

◆ reset()

void cdc::ui::anim::CanvasAnimator::reset ( )

Drop all slots without firing completions (teardown).

Definition at line 241 of file CanvasAnim.cpp.

◆ shiftTime()

void cdc::ui::anim::CanvasAnimator::shiftTime ( uint32_t deltaMs)

Shift every time base forward (view was paused for deltaMs).

Definition at line 233 of file CanvasAnim.cpp.

◆ start()

uint32_t cdc::ui::anim::CanvasAnimator::start ( const TweenConfig & cfg,
uint32_t nowMs )

◆ state()

int8_t cdc::ui::anim::CanvasAnimator::state ( uint32_t handle) const
Returns
STATE_* or -1 when the handle is unknown/finished.

Definition at line 217 of file CanvasAnim.cpp.

References cdc::ui::anim::STATE_DELAYED, cdc::ui::anim::STATE_PAUSED, and cdc::ui::anim::STATE_RUNNING.

Member Data Documentation

◆ MAX_DURATION_MS

uint16_t cdc::ui::anim::CanvasAnimator::MAX_DURATION_MS = 60000
staticconstexpr

Definition at line 120 of file CanvasAnim.h.

Referenced by start().

◆ MAX_TWEENS

uint8_t cdc::ui::anim::CanvasAnimator::MAX_TWEENS = 16
staticconstexpr

Definition at line 119 of file CanvasAnim.h.


The documentation for this class was generated from the following files: