Expand description
Easing curves and script-free local-position animation.
MoveTween runs after ordinary modifiers and before physics, making it
useful for kinematic lifts and animated scene objects. Avoid assigning multiple
independent position writers to one entity: the tween writes last.
use kvas_engine::{scene::Scene, runtime::Runtime, tween::{Ease, MoveTween}};
use kvas_engine::components::Transform;
use glam::Vec3;
let mut scene = Scene::default();
let entity = scene.spawn("lift");
let mut tween = MoveTween::to(Vec3::Y, 1.0).unwrap();
tween.ease = Ease::Linear;
scene.world.insert(entity, tween);
let mut runtime = Runtime::new(scene, None);
runtime.tick(0.1);
assert!((runtime.scene.world.get::<Transform>(entity).unwrap().position.y - 0.1).abs() < 1e-5);Structs§
- Move
Tween - Local-position tween from the first observed pose to a parent-local target. Runtime progress is omitted from serde; loaded/duplicated components start afresh.
Enums§
- Ease
- Normalized interpolation curves. BackOut overshoots; BounceOut rebounds.
- Tween
Mode - Once stops at the target; Repeat jumps to the origin; PingPong reverses each leg.
Functions§
- update
- Advances every position tween by a finite positive simulation delta. Entities without a transform are ignored. Invalid tween data pauses the tween.