mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibWeb: Implement Animation::set_timeline
This commit is contained in:
parent
67fcee6fca
commit
4889f53880
2 changed files with 24 additions and 2 deletions
|
@ -81,8 +81,27 @@ void Animation::set_effect(JS::GCPtr<AnimationEffect> new_effect)
|
||||||
// https://www.w3.org/TR/web-animations-1/#animation-set-the-timeline-of-an-animation
|
// https://www.w3.org/TR/web-animations-1/#animation-set-the-timeline-of-an-animation
|
||||||
void Animation::set_timeline(JS::GCPtr<AnimationTimeline> new_timeline)
|
void Animation::set_timeline(JS::GCPtr<AnimationTimeline> new_timeline)
|
||||||
{
|
{
|
||||||
// FIXME: Implement
|
// Setting this attribute updates the object’s timeline using the procedure to set the timeline of an animation.
|
||||||
(void)new_timeline;
|
|
||||||
|
// 1. Let old timeline be the current timeline of animation, if any.
|
||||||
|
auto old_timeline = m_timeline;
|
||||||
|
|
||||||
|
// 2. If new timeline is the same object as old timeline, abort this procedure.
|
||||||
|
if (new_timeline == old_timeline)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 3. Let the timeline of animation be new timeline.
|
||||||
|
if (m_timeline)
|
||||||
|
m_timeline->disassociate_with_animation(*this);
|
||||||
|
m_timeline = new_timeline;
|
||||||
|
m_timeline->associate_with_animation(*this);
|
||||||
|
|
||||||
|
// 4. If the start time of animation is resolved, make animation’s hold time unresolved.
|
||||||
|
if (m_start_time.has_value())
|
||||||
|
m_hold_time = {};
|
||||||
|
|
||||||
|
// FIXME: 5. Run the procedure to update an animation’s finished state for animation with the did seek flag set to
|
||||||
|
// false, and the synchronously notify flag set to false.
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/web-animations-1/#dom-animation-starttime
|
// https://www.w3.org/TR/web-animations-1/#dom-animation-starttime
|
||||||
|
|
|
@ -70,6 +70,9 @@ private:
|
||||||
// https://www.w3.org/TR/web-animations-1/#animation-start-time
|
// https://www.w3.org/TR/web-animations-1/#animation-start-time
|
||||||
Optional<double> m_start_time {};
|
Optional<double> m_start_time {};
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/web-animations-1/#animation-hold-time
|
||||||
|
Optional<double> m_hold_time {};
|
||||||
|
|
||||||
// https://www.w3.org/TR/web-animations-1/#playback-rate
|
// https://www.w3.org/TR/web-animations-1/#playback-rate
|
||||||
double m_playback_rate { 1.0 };
|
double m_playback_rate { 1.0 };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue