4 <title>CSS Variables - Animation - From and To Values
</title>
6 <meta rel=
"author" title=
"Kevin Babbitt">
7 <meta rel=
"author" title=
"Greg Whitworth">
8 <link rel=
"author" title=
"Microsoft Corporation" href=
"http://microsoft.com" />
9 <link rel=
"help" href=
"http://www.w3.org/TR/css-variables-1/#syntax">
11 <script src=
"/resources/testharness.js"></script>
12 <script src=
"/resources/testharnessreport.js"></script>
16 to { --value: green; }
19 /* Start the animation in the paused state and fill at both ends so we can inspect values from both keyframes. */
22 animation-name: valueanim;
23 animation-duration:
1s;
24 animation-play-state: paused;
25 animation-fill-mode: both;
39 <div id=
"target"><span>This text should animate from blue to green over a period of
1 second.
</span></div>
41 <script type=
"text/javascript">
44 // Force an initial layout pass
45 document
.documentElement
.offsetHeight
;
48 assert_equals(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("--value").trim(), "blue", "--value is blue before animation runs");
49 }, "Verify CSS variable value before animation");
51 var animationTest
= async_test("Verify CSS variable value after animation");
53 animationTest
.step(function() {
55 document
.getElementById("target").addEventListener("animationend", animationTest
.step_func(function() {
56 assert_equals(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("--value").trim(), "green", "--value is green after animation runs")
61 document
.getElementById("target").style
.animationPlayState
= "running";