Skip to content

Commit f1c8a93

Browse files
author
Jan Fischer
committed
Update easing documentation
1 parent a490078 commit f1c8a93

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/docz/src/instructions/Easing.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gsap.registerPlugin(SlowMo)
1313

1414
# Easing
1515

16-
With gsap 3 the easing functions are more easily usable as string without importing. They can be used in the "ease" prop of the `Tween`.
16+
With GSAP 3 the easing functions are more easily usable as string without importing. They can be used in the "ease" prop of the `Tween`.
1717

1818
Have a look at the docs: https://greensock.com/docs/v3/Eases
1919

@@ -47,3 +47,17 @@ This is an extra ease that has to be registered first:
4747
</Tween>
4848
</Controls>
4949
</Playground>
50+
51+
## Custom easing function
52+
53+
You can also pass a function to the ease prop. In this way you can have your custom easing functions.
54+
55+
In the example it's an `easeInOutQuart`. Take a look at this resource for inspiration: https://easings.net/
56+
57+
<Playground>
58+
<Controls playState={PlayState.stop}>
59+
<Tween to={{ x: '200px' }} duration={2} ease={(x) => x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2}>
60+
<div style={{ width: '100px', height: '100px', background: '#ccc' }} />
61+
</Tween>
62+
</Controls>
63+
</Playground>

0 commit comments

Comments
 (0)