1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

LibWeb: Implement AnimationEffect's active_boundary time getters

This commit is contained in:
Matthew Olsson 2023-11-04 11:30:59 -07:00 committed by Andreas Kling
parent baf5220212
commit 6a9c03482f
2 changed files with 17 additions and 0 deletions

View file

@ -200,6 +200,20 @@ double AnimationEffect::active_duration() const
return m_iteration_duration.get<double>() * m_iteration_count;
}
// https://www.w3.org/TR/web-animations-1/#before-active-boundary-time
double AnimationEffect::before_active_boundary_time() const
{
// max(min(start delay, end time), 0)
return max(min(m_start_delay, end_time()), 0.0);
}
// https://www.w3.org/TR/web-animations-1/#active-after-boundary-time
double AnimationEffect::after_active_boundary_time() const
{
// max(min(start delay + active duration, end time), 0)
return max(min(m_start_delay + active_duration(), end_time()), 0.0);
}
AnimationEffect::AnimationEffect(JS::Realm& realm)
: Bindings::PlatformObject(realm)
{