elixirlearners / compounds

A Phoenix UI Components Library | Brew Your Own Interfaces.
3 stars 0 forks source link

set options from DOM for animations #71

Open faroutchris opened 1 year ago

faroutchris commented 1 year ago

Get animation options from DOM

data-compounds-animation="fadeDown"
data-compounds-animation-duration="300"
data-compounds-animation-easing="easeInOut"
data-compounds-animation-iterations="1"

makeAnimation() returns two animations corresponding to the name passed in, ie "fadeDown". type { in: Animation, out: Animation }

This api for animations is just a wrapper for Web Animations API

faroutchris commented 1 year ago

I'm holding off a bit on this one, I'm playing around with resuming and cancelling animations properly, which this api doesn't do well currently.

I have a draft I'm working on but it changes a bit of the api surface. But it might actually make it a lot easier to work with as well.

I'm thinking animate(element, options).moveY(100).rotate(180). And if you chain a new animation on the element, it resumes from its current position and correct duration.

faroutchris commented 11 months ago

Finally done, the api seems pretty easy to use at this point.

@thisisphan @calebgasser

cyanff commented 11 months ago

Very nice! It looks great.