pub struct TweenManager {Show 14 fields
pub named_values: HashMap<String, f32>,
pub screen_fade: f32,
pub screen_shake: f32,
pub screen_bloom_override: Option<f32>,
pub screen_chromatic_override: Option<f32>,
pub screen_vignette_override: Option<f32>,
pub screen_saturation_override: Option<f32>,
pub screen_hue_shift: f32,
pub bar_values: HashMap<BarId, f32>,
pub bar_ghost_values: HashMap<BarId, f32>,
pub camera_fov_override: Option<f32>,
pub camera_position_override: [Option<f32>; 3],
pub camera_target_override: [Option<f32>; 3],
pub camera_trauma_add: f32,
/* private fields */
}Expand description
Central tween manager. Owns all active tweens and provides the game-facing API.
Fields§
§named_values: HashMap<String, f32>Named float values driven by TweenTarget::Named.
screen_fade: f32Screen-level values that the renderer can read each frame.
screen_shake: f32§screen_bloom_override: Option<f32>§screen_chromatic_override: Option<f32>§screen_vignette_override: Option<f32>§screen_saturation_override: Option<f32>§screen_hue_shift: f32§bar_values: HashMap<BarId, f32>Bar fill values, keyed by BarId.
bar_ghost_values: HashMap<BarId, f32>§camera_fov_override: Option<f32>Camera overrides (None = no override, renderer uses defaults).
camera_position_override: [Option<f32>; 3]§camera_target_override: [Option<f32>; 3]§camera_trauma_add: f32Implementations§
Source§impl TweenManager
impl TweenManager
pub fn new() -> Self
Sourcepub fn start(
&mut self,
target: TweenTarget,
from: f32,
to: f32,
duration: f32,
easing: Easing,
) -> TweenId
pub fn start( &mut self, target: TweenTarget, from: f32, to: f32, duration: f32, easing: Easing, ) -> TweenId
Start a tween immediately.
Sourcepub fn start_delayed(
&mut self,
target: TweenTarget,
from: f32,
to: f32,
duration: f32,
delay: f32,
easing: Easing,
) -> TweenId
pub fn start_delayed( &mut self, target: TweenTarget, from: f32, to: f32, duration: f32, delay: f32, easing: Easing, ) -> TweenId
Start a tween with a delay.
Sourcepub fn start_with_callback(
&mut self,
target: TweenTarget,
from: f32,
to: f32,
duration: f32,
easing: Easing,
on_complete: impl FnOnce(&mut TweenManager) + Send + 'static,
) -> TweenId
pub fn start_with_callback( &mut self, target: TweenTarget, from: f32, to: f32, duration: f32, easing: Easing, on_complete: impl FnOnce(&mut TweenManager) + Send + 'static, ) -> TweenId
Start a tween with a completion callback.
Sourcepub fn start_tagged(
&mut self,
target: TweenTarget,
from: f32,
to: f32,
duration: f32,
easing: Easing,
tag: &str,
) -> TweenId
pub fn start_tagged( &mut self, target: TweenTarget, from: f32, to: f32, duration: f32, easing: Easing, tag: &str, ) -> TweenId
Start a tagged tween (for group cancellation).
Sourcepub fn cancel_tag(&mut self, tag: &str)
pub fn cancel_tag(&mut self, tag: &str)
Cancel all tweens with a given tag.
Sourcepub fn cancel_glyph(&mut self, glyph_id: GlyphId)
pub fn cancel_glyph(&mut self, glyph_id: GlyphId)
Cancel all tweens targeting a specific glyph.
Sourcepub fn cancel_all(&mut self)
pub fn cancel_all(&mut self)
Cancel all active tweens.
Sourcepub fn push_raw(
&mut self,
target: TweenTarget,
state: TweenState<f32>,
delay: f32,
tag: Option<String>,
on_complete: Option<Box<dyn FnOnce(&mut TweenManager) + Send>>,
) -> TweenId
pub fn push_raw( &mut self, target: TweenTarget, state: TweenState<f32>, delay: f32, tag: Option<String>, on_complete: Option<Box<dyn FnOnce(&mut TweenManager) + Send>>, ) -> TweenId
Allocate a new ID and push a raw ActiveTween. Used by game_tweens presets.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Number of active tweens.
Sourcepub fn get_bar_ghost(&self, bar: BarId) -> f32
pub fn get_bar_ghost(&self, bar: BarId) -> f32
Get a bar ghost value.
Sourcepub fn tick(&mut self, dt: f32)
pub fn tick(&mut self, dt: f32)
Advance all tweens by dt seconds.
This method:
- Decrements delays on waiting tweens
- Ticks active tweens and reads their current value
- Applies each value to its target (stored in the manager’s output fields)
- Collects completed tweens and runs their on_complete callbacks
- Removes completed/cancelled tweens
Important: This does NOT directly modify the scene. The caller must
read the manager’s output fields (screen_fade, bar_values, etc.)
and apply them to the engine/scene each frame.
Sourcepub fn apply_to_glyphs<F>(&self, apply: F)
pub fn apply_to_glyphs<F>(&self, apply: F)
Apply glyph-targeting tweens to the scene’s glyph pool.
Call this after tick() and before rendering. The caller provides
a mutable closure that can look up and modify glyphs by ID.
Sourcepub fn reset_overrides(&mut self)
pub fn reset_overrides(&mut self)
Reset all screen/camera overrides. Call at the start of each frame
before tick() if you want tweens to be the sole source of overrides.