Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-animating.html

Issue 2809063002: WIP Support var() references in registered custom property keyframes (Closed)
Patch Set: Rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <style>
5 #target {
6 --from: 100;
7 }
8 </style>
9 <div id="target"></div>
10 <script>
11 for (let name of ['--test', '--from', '--to']) {
12 CSS.registerProperty({
13 name,
14 syntax: '<number>',
15 initialValue: '0',
16 });
17 }
18
19 test(() => {
20 let animation = target.animate({'--test': ['var(--from)', 'var(--to)']}, 100);
21 let toAnimation = target.animate({'--to': ['200', '300']}, 100);
22
23 toAnimation.currentTime = 25;
24 {
25 animation.currentTime = 25;
26 // lerp(100, lerp(200, 300, 25%), 25%) == 0.75*100 + 0.25*(0.75*200 + 0.25*3 00) == 131.25
27 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '131.25', 'target at 25%, to at 25%');
28
29 animation.currentTime = 75;
30 // lerp(100, lerp(200, 300, 25%), 75%) == 0.25*100 + 0.75*(0.75*200 + 0.25*3 00) == 193.75
31 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '193.75', 'target at 75%, to at 25%');
32 }
33
34 toAnimation.currentTime = 75;
35 {
36 animation.currentTime = 25;
37 // lerp(100, lerp(200, 300, 75%), 25%) == 0.75*100 + 0.25*(0.25*200 + 0.75*3 00) == 143.75
38 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '143.75', 'target at 25%, to at 25%');
39
40 animation.currentTime = 75;
41 // lerp(100, lerp(200, 300, 75%), 75%) == 0.25*100 + 0.75*(0.25*200 + 0.75*3 00) == 231.25
42 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '231.25', 'target at 75%, to at 25%');
43 }
44 }, 'Registered custom property animation keyframes with var() references to anim ating unregistered custom properties');
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698