offset-path-interpolation-008.html (16945B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>offset-path interpolation with allow-discrete</title> 6 <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property"> 7 <link rel="help" href="https://drafts.csswg.org/css-shapes-2/#interpolating-shape"> 8 <meta name="assert" content="offset-path:shape() supports animation."> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="/css/support/interpolation-testcommon.js"></script> 12 </head> 13 <style> 14 html { 15 font-size: 16px; 16 } 17 .parent { 18 offset-path: shape(from -5px 5px, move to 5% 1px); 19 } 20 .target { 21 offset-path: shape(from 5px 5px, line to 10px 10%); 22 } 23 </style> 24 <body> 25 <script> 26 'use strict'; 27 28 test_interpolation({ 29 property: 'offset-path', 30 from: neutralKeyframe, 31 to: 'shape(from -5px 5px, line to 20px 20%)', 32 }, [ 33 {at: -0.3, expect: 'shape(from 8px 5px, line to 7px 7%)'}, 34 {at: 0, expect: 'shape(from 5px 5px, line to 10px 10%)'}, 35 {at: 0.6, expect: 'shape(from -1px 5px, line to 16px 16%)'}, 36 {at: 1, expect: 'shape(from -5px 5px, line to 20px 20%)'}, 37 {at: 1.5, expect: 'shape(from -10px 5px, line to 25px 25%)'}, 38 ]); 39 40 test_no_interpolation({ 41 property: 'offset-path', 42 from: 'initial', 43 to: 'shape(from 8px 5px, line to 7px 7%)', 44 }); 45 46 test_interpolation({ 47 property: 'offset-path', 48 from: 'inherit', 49 to: 'shape(from 15% 15px, move to 20% -10px)', 50 }, [ 51 {at: -0.3, expect: 'shape(from calc(-4.5% - 6.5px) 2px, move to 0.5% 4.3px)'}, 52 {at: 0, expect: 'shape(from calc(0% - 5px) 5px, move to 5% 1px)'}, 53 {at: 0.5, expect: 'shape(from calc(7.5% - 2.5px) 10px, move to 12.5% -4.5px)'}, 54 {at: 1, expect: 'shape(from 15% 15px, move to 20% -10px'}, 55 {at: 1.5, expect: 'shape(from calc(22.5% + 2.5px) 20px, move to 27.5% -15.5px)'}, 56 ]); 57 58 test_no_interpolation({ 59 property: 'offset-path', 60 from: 'unset', 61 to: 'shape(from 10px 10px, close)', 62 }); 63 64 test_no_interpolation({ 65 property: 'offset-path', 66 from: 'none', 67 to: 'shape(from 10px 10px, close)', 68 }); 69 70 test_no_interpolation({ 71 property: 'offset-path', 72 from: 'shape(from 10px 10px, move to 10% 10%)', 73 to: 'shape(from 10px 10px, close)', 74 }); 75 76 test_interpolation({ 77 property: 'offset-path', 78 from: 'shape(from 5% 5px, hline to 5%, vline to -5px, close)', 79 to: 'shape(from 15% 15px, hline to 25%, vline to -15px, close)', 80 }, [ 81 {at: -0.3, expect: 'shape(from 2% 2px, hline to -1%, vline to -2px, close)'}, 82 {at: 0, expect: 'shape(from 5% 5px, hline to 5%, vline to -5px, close)'}, 83 {at: 0.5, expect: 'shape(from 10% 10px, hline to 15% , vline to -10px, close)'}, 84 {at: 1, expect: 'shape(from 15% 15px, hline to 25%, vline to -15px, close)'}, 85 {at: 1.5, expect: 'shape(from 20% 20px, hline to 35%, vline to -20px, close)'}, 86 ]); 87 88 test_interpolation({ 89 property: 'offset-path', 90 from: 'shape(from 5% 5px, curve to 10% 10px with 0% 80px, curve to 30% 20px with 20% 50px / 25% 70px)', 91 to: 'shape(from 15% 15px, curve to 20% 0px with 10% 60px, curve to 20% 30px with 30% 40px / -5% 100px)', 92 }, [ 93 {at: -0.3, expect: 'shape(from 2% 2px, curve to 7% 13px with -3% 86px, curve to 33% 17px with 17% 53px / 34% 61px)'}, 94 {at: 0, expect: 'shape(from 5% 5px, curve to 10% 10px with 0% 80px, curve to 30% 20px with 20% 50px / 25% 70px)'}, 95 {at: 0.5, expect: 'shape(from 10% 10px, curve to 15% 5px with 5% 70px, curve to 25% 25px with 25% 45px / 10% 85px)'}, 96 {at: 1, expect: 'shape(from 15% 15px, curve to 20% 0px with 10% 60px, curve to 20% 30px with 30% 40px / -5% 100px)'}, 97 {at: 1.5, expect: 'shape(from 20% 20px, curve to 25% -5px with 15% 50px, curve to 15% 35px with 35% 35px / -20% 115px)'}, 98 ]); 99 100 test_interpolation({ 101 property: 'offset-path', 102 from: 'shape(from 5% 5px, curve by 10% 10px with 0% 80px, curve by 30% 20px with 20% 50px / 25% 70px)', 103 to: 'shape(from 15% 15px, curve by 20% 0px with 10% 60px, curve by 20% 30px with 30% 40px / -5% 100px)', 104 }, [ 105 {at: -0.3, expect: 'shape(from 2% 2px, curve by 7% 13px with -3% 86px, curve by 33% 17px with 17% 53px /34% 61px)'}, 106 {at: 0, expect: 'shape(from 5% 5px, curve by 10% 10px with 0% 80px, curve by 30% 20px with 20% 50px / 25% 70px)'}, 107 {at: 0.5, expect: 'shape(from 10% 10px, curve by 15% 5px with 5% 70px, curve by 25% 25px with 25% 45px / 10% 85px)'}, 108 {at: 1.5, expect: 'shape(from 20% 20px, curve by 25% -5px with 15% 50px, curve by 15% 35px with 35% 35px / -20% 115px)'}, 109 ]); 110 111 test_interpolation({ 112 property: 'offset-path', 113 from: 'shape(from 5% 5px, smooth to 10% 10px with 0% 80px, smooth to 30% 20px)', 114 to: 'shape(from 15% 15px, smooth to 20% 0px with 10% 60px, smooth to 20% 30px)', 115 }, [ 116 {at: -0.3, expect: 'shape(from 2% 2px, smooth to 7% 13px with -3% 86px, smooth to 33% 17px)'}, 117 {at: 0, expect: 'shape(from 5% 5px, smooth to 10% 10px with 0% 80px, smooth to 30% 20px)'}, 118 {at: 0.5, expect: 'shape(from 10% 10px, smooth to 15% 5px with 5% 70px, smooth to 25% 25px)'}, 119 {at: 1.5, expect: 'shape(from 20% 20px, smooth to 25% -5px with 15% 50px, smooth to 15% 35px)'}, 120 ]); 121 122 test_interpolation({ 123 property: 'offset-path', 124 from: 'shape(from 5% 5px, smooth by 10% 10px with 0% 80px, smooth by 30% 20px)', 125 to: 'shape(from 15% 15px, smooth by 20% 0px with 10% 60px, smooth by 20% 30px)', 126 }, [ 127 {at: -0.3, expect: 'shape(from 2% 2px, smooth by 7% 13px with -3% 86px, smooth by 33% 17px)'}, 128 {at: 0, expect: 'shape(from 5% 5px, smooth by 10% 10px with 0% 80px, smooth by 30% 20px)'}, 129 {at: 0.5, expect: 'shape(from 10% 10px, smooth by 15% 5px with 5% 70px, smooth by 25% 25px)'}, 130 {at: 1.5, expect: 'shape(from 20% 20px, smooth by 25% -5px with 15% 50px, smooth by 15% 35px)'}, 131 ]); 132 133 test_interpolation({ 134 property: 'offset-path', 135 from: 'shape(from 5% 5px, arc to 15% -15px of 10px 20px, arc by 15% -5px of 30px 30px cw rotate 30deg large, arc to 25% 20px of 10px 5px small)', 136 to: 'shape(from 15% 15px, arc to 5% -25px of 20px 30px, arc by 25% -15px of 20px 20px cw rotate 270deg small, arc to 25% 20px of 10px 5px small cw)' 137 }, [ 138 {at: -0.3, expect: 'shape(from 2% 2px, arc to 18% -12px of 7px 17px ccw small, arc by 12% -2px of 33px 33px rotate -42deg cw large , arc to 25% 20px of 10px 5px ccw small)'}, 139 {at: 0, expect: 'shape(from 5% 5px, arc to 15% -15px of 10px 20px, arc by 15% -5px of 30px 30px cw rotate 30deg large, arc to 25% 20px of 10px 5px small)'}, 140 {at: 0.3, expect: 'shape(from 8% 8px, arc to 12% -18px of 13px 23px ccw small, arc by 18% -8px of 27px 27px rotate 102deg cw large, arc to 25% 20px of 10px 5px cw small )'}, 141 {at: 0.5, expect: 'shape(from 10% 10px, arc to 10% -20px of 15px 25px ccw small, arc by 20% -10px of 25px 25px rotate 150deg cw large, arc to 25% 20px of 10px 5px cw small)'}, 142 {at: 1, expect: 'shape(from 15% 15px, arc to 5% -25px of 20px 30px, arc by 25% -15px of 20px 20px rotate 270deg cw small, arc to 25% 20px of 10px 5px cw small)'}, 143 {at: 1.5, expect: 'shape(from 20% 20px, arc to 0% -30px of 25px 35px ccw small, arc by 30% -20px of 15px 15px rotate 390deg cw small, arc to 25% 20px of 10px 5px cw small)'}, 144 ]); 145 146 test_interpolation({ 147 property: 'offset-path', 148 from: 'shape(from 5px -5%, hline to 10px, vline by 10rem, hline by 8.25px, close, vline by 3pt)', 149 to: 'shape(from -5px 5px, hline to 20px, vline by 10%, hline by 1em, close, vline by 6pt)', 150 }, [ 151 {at: -0.3, expect: 'shape(from 8px calc(-6.5% - 1.5px), hline to 7px, vline by calc(-3% + 208px), hline by 5.92px, close, vline by 2.8px)'}, 152 {at: 0, expect: 'shape(from 5px -5%, hline to 10px, vline by calc(0% + 160px), hline by 8.25px, close, vline by 4px)'}, 153 {at: 0.6, expect: 'shape(from -1px calc(-2% + 3px), hline to 16px, vline by calc(6% + 64px), hline by 12.9px, close ,vline by 6.4px)'}, 154 {at: 1, expect: 'shape(from -5px calc(0% + 5px), hline to 20px, vline by 10%, hline by 16px, close, vline by 8px)'}, 155 {at: 1.5, expect: 'shape(from -10px calc(2.5% + 7.5px), hline to 25px, vline by calc(15% - 80px), hline by 19.88px, close, vline by 10px)'}, 156 ]); 157 158 test_no_interpolation({ 159 property: 'offset-path', 160 from: 'shape(from 10px 10px, move to 10% 10%)', 161 to: 'path("M10 10 z")', 162 }); 163 164 test_no_interpolation({ 165 property: 'offset-path', 166 from: 'path("M10 10 M10 10")', 167 to: 'shape(from 10px 10px, close)', 168 }); 169 170 test_no_interpolation({ 171 property: 'offset-path', 172 from: 'path("M10 10 h 5")', 173 to: 'shape(from 10px 10px, hline to 5px)', 174 }); 175 176 test_interpolation({ 177 property: 'offset-path', 178 from: 'shape(from 5px 5px, hline to 5px, vline to -5px, close)', 179 to: 'path("M 15 15 H 25 V -15 Z")', 180 }, [ 181 {at: -0.3, expect: 'shape(from 2px 2px, hline to -1px, vline to -2px, close)'}, 182 {at: 0, expect: 'shape(from 5px 5px, hline to 5px, vline to -5px, close)'}, 183 {at: 0.5, expect: 'shape(from 10px 10px, hline to 15px, vline to -10px, close)'}, 184 {at: 1, expect: 'shape(from 15px 15px, hline to 25px, vline to -15px, close)'}, 185 {at: 1.5, expect: 'shape(from 20px 20px, hline to 35px, vline to -20px, close)'}, 186 ]); 187 188 test_interpolation({ 189 property: 'offset-path', 190 from: 'shape(from 5% 5px, curve to 10% 10px with 0% 80px, curve to 30% 20px with 20% 50px / 25% 70px)', 191 to: 'path("M 15 15 Q 10 60 20 0 C 30 40 -5 100 20 30")', 192 }, [ 193 {at: -0.3, expect: 'shape(from calc(6.5% - 4.5px) 2px, curve to calc(13% - 6px) 13px with calc(0% - 3px) 86px, curve to calc(39% - 6px) 17px with calc(26% - 9px) 53px / calc(32.5% + 1.5px) 61px)'}, 194 {at: 0, expect: 'shape(from 5% 5px, curve to 10% 10px with 0% 80px, curve to 30% 20px with 20% 50px / 25% 70px)'}, 195 {at: 0.5, expect: 'shape(from calc(2.5% + 7.5px) 10px, curve to calc(5% + 10px) 5px with calc(0% + 5px) 70px, curve to calc(15% + 10px) 25px with calc(10% + 15px) 45px / calc(12.5% - 2.5px) 85px)'}, 196 {at: 1, expect: 'shape(from calc(0% + 15px) 15px, curve to calc(0% + 20px) 0px with calc(0% + 10px) 60px, curve to calc(0% + 20px) 30px with calc(0% + 30px) 40px / calc(0% - 5px) 100px)'}, 197 {at: 1.5, expect: 'shape(from calc(-2.5% + 22.5px) 20px, curve to calc(-5% + 30px) -5px with calc(0% + 15px) 50px, curve to calc(-15% + 30px) 35px with calc(-10% + 45px) 35px / calc(-12.5% - 7.5px) 115px)'}, 198 ]); 199 200 test_interpolation({ 201 property: 'offset-path', 202 from: 'path("M 5 5 q 0 80 10 10 c 20 50 25 70 30 20")', 203 to: 'shape(from 15% 15px, curve by 20% 0px with 10% 60px, curve by 20% 30px with 30% 40px / -5% 100px)', 204 }, [ 205 {at: -0.3, expect: 'shape(from calc(-4.5% + 6.5px) 2px, curve by calc(-6% + 13px) 13px with -3% 86px, curve by calc(-6% + 39px) 17px with calc(-9% + 26px) 53px / calc(1.5% + 32.5px) 61px)'}, 206 {at: 0, expect: 'shape(from calc(0% + 5px) 5px, curve by calc(0% + 10px) 10px with 0% 80px, curve by calc(0% + 30px) 20px with calc(0% + 20px) 50px / calc(0% + 25px) 70px)'}, 207 {at: 0.5, expect: 'shape(from calc(7.5% + 2.5px) 10px, curve by calc(10% + 5px) 5px with 5% 70px, curve by calc(10% + 15px) 25px with calc(15% + 10px) 45px / calc(-2.5% + 12.5px) 85px)'}, 208 {at: 1, expect: 'shape(from 15% 15px, curve by 20% 0px with 10% 60px, curve by 20% 30px with 30% 40px / -5% 100px)'}, 209 {at: 1.5, expect: 'shape(from calc(22.5% - 2.5px) 20px, curve by calc(30% - 5px) -5px with 15% 50px, curve by calc(30% - 15px) 35px with calc(45% - 10px) 35px / calc(-7.5% - 12.5px) 115px)'}, 210 ]); 211 212 test_interpolation({ 213 property: 'offset-path', 214 from: 'shape(from 5% 5px, smooth to 10% 10px with 0% 80px, smooth to 30% 20px)', 215 to: 'path("M 15 15 S 10 60 20 0 T 20 30")', 216 }, [ 217 {at: -0.3, expect: 'shape(from calc(6.5% - 4.5px) 2px, smooth to calc(13% - 6px) 13px with calc(0% - 3px) 86px, smooth to calc(39% - 6px) 17px)'}, 218 {at: 0, expect: 'shape(from 5% 5px, smooth to 10% 10px with 0% 80px, smooth to 30% 20px)'}, 219 {at: 0.5, expect: 'shape(from calc(2.5% + 7.5px) 10px, smooth to calc(5% + 10px) 5px with calc(0% + 5px) 70px, smooth to calc(15% + 10px) 25px)'}, 220 {at: 1, expect: 'shape(from calc(0% + 15px) 15px, smooth to calc(0% + 20px) 0px with calc(0% + 10px) 60px, smooth to calc(0% + 20px) 30px)'}, 221 {at: 1.5, expect: 'shape(from calc(-2.5% + 22.5px) 20px, smooth to calc(-5% + 30px) -5px with calc(0% + 15px) 50px, smooth to calc(-15% + 30px) 35px)'}, 222 ]); 223 224 test_interpolation({ 225 property: 'offset-path', 226 from: 'path("M 5 5 s 0 80 10 10 t 30 20")', 227 to: 'shape(from 15px 15px, smooth by 20px 0px with 10px 60px, smooth by 20px 30px)', 228 }, [ 229 {at: -0.3, expect: 'shape(from 2px 2px, smooth by 7px 13px with -3px 86px, smooth by 33px 17px)'}, 230 {at: 0, expect: 'shape(from 5px 5px, smooth by 10px 10px with 0px 80px, smooth by 30px 20px)'}, 231 {at: 0.5, expect: 'shape(from 10px 10px, smooth by 15px 5px with 5px 70px, smooth by 25px 25px)'}, 232 {at: 1, expect: 'shape(from 15px 15px, smooth by 20px 0px with 10px 60px, smooth by 20px 30px)'}, 233 {at: 1.5, expect: 'shape(from 20px 20px, smooth by 25px -5px with 15px 50px, smooth by 15px 35px)'}, 234 ]); 235 236 test_interpolation({ 237 property: 'offset-path', 238 from: 'shape(from 5% 5px, arc to 15% -15px of 10px 20px, arc by 15% -5px of 30px 30px cw rotate 30deg large, arc to 25% 20px of 10px 5px small)', 239 to: 'path("M 15 15 A 20,30 0 0,0 5,-25 a 20,20 270 0,1 25,-15 A 10,5 0 0,0 25 20")', 240 }, [ 241 {at: -0.3, expect: 'shape(from calc(6.5% - 4.5px) 2px, arc to calc(19.5% - 1.5px) -12px of 7px 17px, arc by calc(19.5% - 7.5px) -2px of 33px 33px cw large rotate -42deg, arc to calc(32.5% - 7.5px) 20px of 10px 5px)'}, 242 {at: 0, expect: 'shape(from 5% 5px, arc to 15% -15px of 10px 20px, arc by 15% -5px of 30px 30px cw large rotate 30deg, arc to 25% 20px of 10px 5px)'}, 243 {at: 0.3, expect: 'shape(from calc(3.5% + 4.5px) 8px, arc to calc(10.5% + 1.5px) -18px of 13px 23px, arc by calc(10.5% + 7.5px) -8px of 27px 27px cw large rotate 102deg, arc to calc(17.5% + 7.5px) 20px of 10px 5px)'}, 244 {at: 0.5, expect: 'shape(from calc(2.5% + 7.5px) 10px, arc to calc(7.5% + 2.5px) -20px of 15px 25px, arc by calc(7.5% + 12.5px) -10px of 25px 25px cw large rotate 150deg, arc to calc(12.5% + 12.5px) 20px of 10px 5px)'}, 245 {at: 1, expect: 'shape(from calc(0% + 15px) 15px, arc to calc(0% + 5px) -25px of 20px 30px, arc by calc(0% + 25px) -15px of 20px 20px cw rotate 270deg, arc to calc(0% + 25px) 20px of 10px 5px)'}, 246 {at: 1.5, expect: 'shape(from calc(-2.5% + 22.5px) 20px, arc to calc(-7.5% + 7.5px) -30px of 25px 35px, arc by calc(-7.5% + 37.5px) -20px of 15px 15px cw rotate 390deg, arc to calc(-12.5% + 37.5px) 20px of 10px 5px)'}, 247 ]); 248 249 test_interpolation({ 250 property: 'offset-path', 251 from: 'path("M 5 5 A 10,20 0 0,0 15,-15 a 30,30 30 1,1 15,-5 A 10,5 0 0,0 25 20")', 252 to: 'shape(from 15px 15px, arc to 5px -25px of 20px 30px, arc by 25px -15px of 20px 20px cw rotate 270deg small, arc to 25px 20px of 10px 5px small cw)' 253 }, [ 254 {at: -0.3, expect: 'shape(from 2px 2px, arc to 18px -12px of 7px 17px ccw small, arc by 12px -2px of 33px 33px rotate -42deg cw large, arc to 25px 20px of 10px 5px ccw small)'}, 255 {at: 0, expect: 'shape(from 5px 5px, arc to 15px -15px of 10px 20px, arc by 15px -5px of 30px 30px cw rotate 30deg large, arc to 25px 20px of 10px 5px small)'}, 256 {at: 0.3, expect: 'shape(from 8px 8px, arc to 12px -18px of 13px 23px ccw small, arc by 18px -8px of 27px 27px rotate 102deg cw large, arc to 25px 20px of 10px 5px cw small)'}, 257 {at: 0.5, expect: 'shape(from 10px 10px, arc to 10px -20px of 15px 25px ccw small, arc by 20px -10px of 25px 25px rotate 150deg cw large, arc to 25px 20px of 10px 5px cw small)'}, 258 {at: 1, expect: 'shape(from 15px 15px, arc to 5px -25px of 20px 30px, arc by 25px -15px of 20px 20px rotate 270deg cw small, arc to 25px 20px of 10px 5px cw small)'}, 259 {at: 1.5, expect: 'shape(from 20px 20px, arc to 0px -30px of 25px 35px ccw small, arc by 30px -20px of 15px 15px rotate 390deg cw small, arc to 25px 20px of 10px 5px cw small)'}, 260 ]); 261 262 </script> 263 </body> 264 </html>