ssbc / visual-docs

Diagrams and animations documenting Secure Scuttlebutt (scuttlebutt.nz) and Āhau (ahau.io)
https://scuttlebutt.nz
Other
16 stars 1 forks source link

convert cubicBezier & steps easings #8

Open cameralibre opened 3 years ago

cameralibre commented 3 years ago

Anime.js provides multiple types of easings.

Some types of anime.js easings are now being converted to CSS ( #2 ):

Some types of easing will not work in CSS, so I can't support them:

❎️ easeInElastic, easeOutBounce etc ❎️ spring equations ❎️ custom easing functions

Some types should be quite straightforward to convert, as they are based upon CSS themselves:

cameralibre commented 3 years ago

Some types should be quite straightforward to convert, as they are based upon CSS themselves:

  • [ ] cubicBezier()➡️ cubic-bezier()

Actually this is not straightforward at all, or at least, I can't use the same lookup table approach - there is a small, finite number of Penner's easings, so each one will create a unique fingerprint when run on two values (0.2 & 0.7), and I can be sure that all are covered by hardcoding them in the script.

cubic-bezier() however, has a theoretically infinite number of variations, and I don't think that just two data points will describe the whole curve.

cameralibre commented 3 years ago

It might be worth exploring bezier.js to see if it can get control points from given points on a curve