1
0
Fork 0
forked from wry/wry

Add spawn-in window animations

This commit is contained in:
atagen 2026-05-21 16:06:33 +10:00
parent 7575f851fe
commit 18ffaef64d
6 changed files with 157 additions and 12 deletions

View file

@ -4,6 +4,7 @@ use {
allocator::BufferObject,
animation::{
AnimationCurve, AnimationState, AnimationTick, RetainedToplevel, expand_damage_rect,
spawn_in_start_rect,
},
async_engine::{AsyncEngine, SpawnedFuture},
backend::{
@ -1516,6 +1517,33 @@ impl State {
}
}
pub fn queue_spawn_in_animation(
self: &Rc<Self>,
node_id: NodeId,
target: Rect,
retained: Option<Rc<RetainedToplevel>>,
) {
if !self.animations.enabled.get() || target.is_empty() {
return;
}
let start = spawn_in_start_rect(target);
let now = self.now_nsec();
let started = self.animations.set_spawn_in(
node_id,
target,
retained,
now,
self.animations.duration_ms.get(),
);
if started {
self.damage(expand_damage_rect(
start.union(target),
self.theme.sizes.border_width.get().max(0),
));
self.ensure_animation_tick();
}
}
pub fn set_animations_enabled(&self, enabled: bool) {
if self.animations.enabled.replace(enabled) && !enabled {
self.animations.clear();