Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate Plugin #18

Merged
merged 4 commits into from
Sep 15, 2020
Merged

Animate Plugin #18

merged 4 commits into from
Sep 15, 2020

Conversation

gregkohn
Copy link
Contributor

@gregkohn gregkohn commented Sep 11, 2020

Easier version of the README to read here

This was directly inspired by some Viget.com work and a general trend towards our designers wanting to apply these more often.

The README explains the purpose and usage, but one thing I'm especially curious about the verbiage in general that I used. I'll admit that an animate plugin is not obviously different from the animation utilities, but it's a rather tricky thing to pin down in a simple name. In short, this generates utilities that would generally be used with Intersection Observer in order to achieve "animate on scroll" or "scroll reveal" type functionalities (those are both existing library names). This plugin isn't intrinsically tied to scrolling, though, so not sure how much that makes sense to mention.

In addition, I went with animate- and stagger- utilities -- let me know how you feel about all these as well!

Demo

Made a CodePen with some of the outputted utilities to demonstrate some of these (the triggerClass is just being toggled in a setInterval as opposed to being added via Intersection Observer):
https://codepen.io/gregkohn/pen/abNVQry?editors=1000

Copy link
Contributor

@davist11 davist11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dope

@@ -0,0 +1,113 @@
# animate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there plans to move to a docs folder and just the docs for this? Seems like it would work really well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah #16
absolutely agree

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

{
'[class*="stagger-"] > *': {
'--stagger-delay': '0s',
'transition-delay': `calc(var(--animate-index) * ${staggerInterval.default} + var(--stagger-delay))`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa wild

@gregkohn
Copy link
Contributor Author

^ This latest commit is super handy for applying animations on elements that might already specify one of the properties you are trying to transition. Previously, for example, using animate-fade-up from the README example would override an existing opacity value on an element, forcing it to opacity: 1 no matter what. By making the to optional, you can transition to the element's specified value or the CSS default.

Copy link
Contributor

@jeremyfrank jeremyfrank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool 👍

@gregkohn gregkohn merged commit 2ec3ac6 into main Sep 15, 2020
@gregkohn gregkohn deleted the gk/animate branch March 5, 2021 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants