Quantcast
Channel: Pens from Dan Wilson
Viewing all articles
Browse latest Browse all 599

Spiral with WAAPI iterationComposite

$
0
0

See the Code - See it Full Page - See Details

_As of 11/28/2017 only in Firefox Nightly (59)_ The new property `iterationComposite` in the Web Animations API allows you to build on previous iterations. Here we have an animation going from a default state to a small rotation + a small translation. When we set it to a lot of iterations, each iteration will be on the last when we specify `iterationComposite: 'accumulate'`. After the first iteration we will have the expected rotation + translation value. After the second iteration it will be twice the rotation and twice the translation. This is because, using the rotation only as an example, the first iteration goes from `0deg` to `5deg`. The second iteration will do the same 0 to 5 change but add it on top of where the first iteration ended (5deg) resulting in an end state of 10deg. The third iteration will do the same but on top of the 10deg, resulting in 15deg, and so on. The translation is also occurring in the same manner. At the end of the iterations (assuming 400 iterations), the resulting transform will be equivalent to `rotate(calc(400 * 5deg)) translateX(calc(400 * .125vmin))`

This Pen uses: HTML, CSS, JavaScript, and


Viewing all articles
Browse latest Browse all 599

Trending Articles