mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
LibWeb: Add the Animatable IDL object
This commit is contained in:
parent
4792dc294b
commit
daaaaec2d0
5 changed files with 84 additions and 0 deletions
34
Userland/Libraries/LibWeb/Animations/Animatable.h
Normal file
34
Userland/Libraries/LibWeb/Animations/Animatable.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/Animations/KeyframeEffect.h>
|
||||
|
||||
namespace Web::Animations {
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dictdef-keyframeanimationoptions
|
||||
struct KeyframeAnimationOptions : public KeyframeEffectOptions {
|
||||
FlyString id { ""_fly_string };
|
||||
JS::GCPtr<AnimationTimeline> timeline;
|
||||
};
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dictdef-getanimationsoptions
|
||||
struct GetAnimationsOptions {
|
||||
bool subtree { false };
|
||||
};
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#animatable
|
||||
class Animatable {
|
||||
public:
|
||||
virtual ~Animatable() = default;
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<Animation>> animate(Optional<JS::Handle<JS::Object>> keyframes, Variant<Empty, double, KeyframeAnimationOptions> options = {});
|
||||
Vector<JS::NonnullGCPtr<Animation>> get_animations(GetAnimationsOptions options = {});
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue