6 background-color: #
00ff00;
9 <script src=
"../common.js"></script>
11 <script id=
"iframe_worklet" type=
"text/worklet">
12 registerAnimator(
"iframe_animator", class {
13 animate(currentTime, effect) {
14 effect.localTime =
600;
17 registerAnimator(
"duplicate_animator", class {
18 animate(currentTime, effect) {
19 effect.localTime =
800;
24 <div id=
"iframe_target" class=
"greenbox"></div>
27 runInAnimationWorklet(
28 document
.getElementById('iframe_worklet').textContent
30 const target
= document
.getElementById('iframe_target');
31 // Only create an animation for iframe_animator.
32 const effect
= new KeyframeEffect(target
, [{ opacity
: 0 }], { duration
: 1000 });
33 const animation
= new WorkletAnimation('iframe_animator', effect
);
35 waitTwoAnimationFrames( _
=> {
36 window
.parent
.postMessage(getComputedStyle(target
).opacity
, '*');