CubicBezier: Animating in LiveView

CubicBezier

https://hexdocs.pm/cubic_bezier/getting-started.html

This library is essentially a port of the Webkit implementation of the cubic bezier timing function used for CSS animations and transitions.

Originally, it was built for personal use when seeing how far I could push LiveView, in an attempt to “stream” tween updates (worked great!). Easing equations help make state transitions feel more natural / organic by adjusting the “speed”. An “ease out” function will start fast and end slow.

Example:

CubicBezier.solve(0.25, :ease_out_quad)
# Returns 0.45

Feedback welcome!

3 Likes