CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
CanvasAnim.h File Reference

Host-side animation engine for the plugin canvas: fixed-point easing, element-offset tweens and multi-frame sprite playback. More...

#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Classes

struct  cdc::ui::anim::Completion
class  cdc::ui::anim::AnimTarget
 Interface the animator drives; implemented by CanvasView on its elements. More...
struct  cdc::ui::anim::TweenConfig
 Tween start configuration (mirrors host_anim_t plus the blink shorthand). More...
class  cdc::ui::anim::CanvasAnimator
 Fixed-slot tween engine animating element offsets (plus a blink convenience that toggles visibility). More...
class  cdc::ui::anim::SpriteStore
 Fixed-slot store for multi-frame 1-bpp sprites with host-driven playback. Pixel data lives in an injected arena (PSRAM, owner-held). More...
struct  cdc::ui::anim::SpriteStore::FrameView
 Replay accessors: geometry, flags and pixel pointers of a sprite. More...

Namespaces

namespace  cdc
namespace  cdc::ui
 Centralized key-code constants for cdc_views.
namespace  cdc::ui::anim

Enumerations

enum  : uint8_t {
  cdc::ui::anim::EASE_LINEAR = 0 , cdc::ui::anim::EASE_QUAD_IN = 1 , cdc::ui::anim::EASE_QUAD_OUT = 2 , cdc::ui::anim::EASE_QUAD_IN_OUT = 3 ,
  cdc::ui::anim::EASE_CUBIC_IN = 4 , cdc::ui::anim::EASE_CUBIC_OUT = 5 , cdc::ui::anim::EASE_CUBIC_IN_OUT = 6 , cdc::ui::anim::EASE_OVERSHOOT = 7 ,
  cdc::ui::anim::EASE_BOUNCE = 8 , cdc::ui::anim::EASE_STEP = 9 , cdc::ui::anim::EASE_ELASTIC = 10 , cdc::ui::anim::EASE_COUNT = 11
}
 Easing curves. Values mirror the HOST_EASE_* ids in host_api.h. More...
enum  : uint8_t { cdc::ui::anim::FLAG_FROM_CURRENT = 0x01 , cdc::ui::anim::FLAG_YOYO = 0x02 , cdc::ui::anim::FLAG_HIDE_DONE = 0x04 , cdc::ui::anim::FLAG_SHOW_START = 0x08 }
 Tween flags. Values mirror the HOST_ANIM_FLAG_* ids in host_api.h. More...
enum  : int8_t { cdc::ui::anim::STATE_DELAYED = 0 , cdc::ui::anim::STATE_RUNNING = 1 , cdc::ui::anim::STATE_PAUSED = 2 }
 Tween/playback states as reported by CanvasAnimator::state(). More...
enum  : uint8_t { cdc::ui::anim::SPRITE_ONCE = 0 , cdc::ui::anim::SPRITE_LOOP = 1 , cdc::ui::anim::SPRITE_PING_PONG = 2 }
 Sprite playback modes. Values mirror the HOST_SPRITE_* ids in host_api.h. More...
enum  : uint8_t { cdc::ui::anim::SPRITE_FLAG_OPAQUE = 0x01 , cdc::ui::anim::SPRITE_FLAG_FLIP_H = 0x02 , cdc::ui::anim::SPRITE_FLAG_FLIP_V = 0x04 , cdc::ui::anim::SPRITE_FLAG_ROT_90 = 0x08 }
 Sprite flags. Values mirror the HOST_SPRITE_FLAG_* ids in host_api.h. More...

Functions

int32_t cdc::ui::anim::ease (uint8_t curve, int32_t t)
 Apply an easing curve to a normalized 8.8 fixed-point time.

Variables

constexpr uint16_t cdc::ui::anim::REPEAT_FOREVER = 0xFFFF
 Repeat-forever sentinel shared by tweens and sprite playback.

Detailed Description

Host-side animation engine for the plugin canvas: fixed-point easing, element-offset tweens and multi-frame sprite playback.

Pure logic with no ESP-IDF, FreeRTOS or display dependencies: time is passed in as milliseconds, results are applied through the AnimTarget interface and the sprite pixel arena is injected by the owner. This keeps the engine unit testable in the native PlatformIO environment (see test/host).

Definition in file CanvasAnim.h.