@@ -33,13 +33,29 @@ export const easeEmphasized = createEase([
33
33
[ 0.25 , 1 ] ,
34
34
[ 1 , 1 ] ,
35
35
] ,
36
- ] ) ; /* css versions:
37
- with limited overshoot:
36
+ ] ) ;
37
+ /*
38
+ === NEW CSS VERSION ===
39
+ is in var(--m3-easing), generated with
40
+ const createCSSEase = (lutOptions: [number, number][][]) => {
41
+ const lut = lutOptions.map((args) => createBezierLUT(args)).flat();
42
+ let stops: number[] = [];
43
+ for (let t = 0; t <= 1; t += 0.01) {
44
+ const closestPoint = lut.find((p) => p[0] >= t);
45
+ const closestY = closestPoint ? closestPoint[1] : 1;
46
+ stops.push(closestY);
47
+ }
48
+
49
+ return `linear(${stops.map((s) => +s.toFixed(3)).join(", ")})`;
50
+ };
51
+
52
+ === OLD CSS VERSION: LIMITED OVERSHOOT ===
38
53
https://cdn.discordapp.com/attachments/1058124584286683237/1064238491904524308/w9blD3eMKQBwAAAABJRU5ErkJggg.png
39
54
cubic-bezier(0.254, 0.029, 0, 1.2) is preferred, it is the most accurate to the acceleration
40
55
cubic-bezier(0.356, 0.701, 0, 1.004) is the most accurate to the deceleration
41
56
cubic-bezier(0.291, 0.281, 0, 1.2) has no weighting
42
- unlimited overshoot:
57
+
58
+ === OLD CSS VERSION: UNLIMITED OVERSHOOT ===
43
59
https://cdn.discordapp.com/attachments/1058124584286683237/1064238129306927124/H47ZvYKwT8COjeuQXsI8AE4554luCbtMqAAqAJubZ9I2452QBcREREJgab5REREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBP8PcBLo5kfHxSYAAAAASUVORK5CYII.png
44
60
cubic-bezier(0.271, -0.011, 0, 1.449) is the most accurate to the acceleration (but has a large overshoot)
45
61
the deceleration is the same as before
0 commit comments