1 module libwasm.bindings.Animatable; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.Animation; 7 import libwasm.bindings.KeyframeAnimationOptions; 8 import libwasm.bindings.KeyframeEffect; 9 10 @safe: 11 nothrow: 12 13 struct Animatable { 14 nothrow: 15 JsHandle handle; 16 alias handle this; 17 this(Handle h) { 18 this.handle = JsHandle(h); 19 } 20 auto animate(T0)(scope auto ref Optional!(T0) keyframes, scope ref SumType!(double, KeyframeAnimationOptions) options) if (isTOrPointer!(T0, JsObject)) { 21 return Animation(Serialize_Object_VarArgCall!Handle(this.handle, "animate", "Optional!Handle;SumType!(double,Handle)", tuple(!keyframes.empty, cast(Handle)keyframes.front.handle, libwasm.sumtype.match!(((double v) => 0),((ref options.Types[1] v) => 1))(options),tuple(libwasm.sumtype.match!(((double v) => v),((ref options.Types[1] v) => double.init))(options),libwasm.sumtype.match!(((double v) => Handle.init),((ref options.Types[1] v) => cast(Handle)v.handle))(options))))); 22 } 23 auto animate(T0)(scope auto ref Optional!(T0) keyframes) if (isTOrPointer!(T0, JsObject)) { 24 return Animation(Serialize_Object_VarArgCall!Handle(this.handle, "animate", "Optional!Handle", tuple(!keyframes.empty, cast(Handle)keyframes.front.handle))); 25 } 26 auto getAnimations()(scope ref AnimationFilter filter) { 27 return Sequence!(Animation)(Object_Call_Handle__Handle(this.handle, "getAnimations", filter.handle)); 28 } 29 auto getAnimations()() { 30 return Sequence!(Animation)(Object_Getter__Handle(this.handle, "getAnimations")); 31 } 32 } 33 struct AnimationFilter { 34 nothrow: 35 JsHandle handle; 36 alias handle this; 37 this(Handle h) { 38 this.handle = JsHandle(h); 39 } 40 static auto create() { 41 return AnimationFilter(libwasm_add__object()); 42 } 43 void subtree()(bool subtree) { 44 Object_Call_bool__void(this.handle, "subtree", subtree); 45 } 46 bool subtree()() { 47 return Object_Getter__bool(this.handle, "subtree"); 48 } 49 } 50 struct KeyframeAnimationOptions { 51 nothrow: 52 libwasm.bindings.KeyframeEffect.KeyframeEffectOptions _parent; 53 alias _parent this; 54 this(Handle h) { 55 _parent = .KeyframeEffectOptions(h); 56 } 57 static auto create() { 58 return KeyframeAnimationOptions(libwasm_add__object()); 59 } 60 void id()(string id) { 61 Object_Call_string__void(this._parent, "id", id); 62 } 63 string id()() { 64 return Object_Getter__string(this._parent, "id"); 65 } 66 } 67 68