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

[feature request] Configurable magnitude #1009

Open
chriscconte opened this issue Jan 13, 2020 · 18 comments
Open

[feature request] Configurable magnitude #1009

chriscconte opened this issue Jan 13, 2020 · 18 comments
Assignees
Labels
feature request under consideration We might implement or accept this, but it still can be closed or denied v5
Projects

Comments

@chriscconte
Copy link

It would be cool if there were a helper class to determine the magnitude of the motion, this could be very useful for smaller elements!

@warengonzaga
Copy link
Member

can you provide some example?

@eltonmesquita
Copy link
Collaborator

Yeah, that is doable with css custom-properties. When I get back coding I'll have a look in how we can provide this.

@raxraj
Copy link

raxraj commented Apr 22, 2020

ahoy!! can I work on that??

@warengonzaga
Copy link
Member

warengonzaga commented Apr 22, 2020

@raxraj sadly assigned to @eltonmesquita... ;)

@raxraj
Copy link

raxraj commented Apr 22, 2020

oh! I see, well I will keep trying then.

@eltonmesquita
Copy link
Collaborator

This didn't make into the v4.0.0 release, but I'll try to prioritize this feature in the next release (probably the next minor version).

@warengonzaga
Copy link
Member

@eltonmesquita looking forward!

@wjxniubi

This comment was marked as off-topic.

@warengonzaga

This comment was marked as off-topic.

@wjxniubi

This comment was marked as off-topic.

@raxraj

This comment was marked as off-topic.

@wjxniubi

This comment was marked as off-topic.

@raxraj
Copy link

raxraj commented May 13, 2020

@wjxniubi Happy to Help :)

@warengonzaga
Copy link
Member

@eltonmesquita any news on this? is this relate to our current project?

@eltonmesquita
Copy link
Collaborator

Nope, I'm pushing this as it's a bit of a laborious task. And no, it should be handled by animate.css.

@EliotSlevin
Copy link

EliotSlevin commented Nov 29, 2020

Yeah, I'd love this.

So classic example is the 'fade up' animation. It has a vertical movement of 100% to 0%. That works great for small elements, like say fading in a title on a marketing website. Lil subtle touch, very nice.

Thing is when you want to go and fade in like a whole block, which is say like 450px tall - suddenly this super subtle animation is crazy huge motion, crazy fast etc. It's just far too much. And the visual consistency across the page changes - they're all moving slightly different speeds. I'm using react-awesome-reveal , which uses animate.css but I think it's something that could be worth looking at for animate.css, not at the library level.

A few ideas for how it could be solved:

Configurable distance
If some animations had a 'distance' prop which could just be any css value and unit. E.g.

:root {
  --animate-distance: ['20px', '100%', '3em', etc ];
}

@keyframes fadeInTop {
  from {
    opacity: 0;
    transform: translate3d(0, var(--animate-distance, 100%), 0); // fallback value if var isn't set
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

Range of classes
Some libraries probably wouldn't want to pass through a custom prop to inject into the css. A more lo-fi solution could be generating a range of classes for each animation. e.g. Way less flexible though.

@keyframes fadeInTop {  from {  ...   translate3d(0, 100%, 0) }....
@keyframes fadeInTop-50 {  from {  ...   translate3d(0, 50%, 0) }....
@keyframes fadeInTop-25 {  from {  ...   translate3d(0, 25%, 0) }....
@keyframes fadeInTop-10 {  from {  ...   translate3d(0, 10%, 0) }....

@warengonzaga
Copy link
Member

Yeah, I'd love this.

So classic example is the 'fade up' animation. It has a vertical movement of 100% to 0%. That works great for small elements, like say fading in a title on a marketing website. Lil subtle touch, very nice.

Thing is when you want to go and fade in like a whole block, which is say like 450px tall - suddenly this super subtle animation is crazy huge motion, crazy fast etc. It's just far too much. And the visual consistency across the page changes - they're all moving slightly different speeds. I'm using react-awesome-reveal , which uses animate.css but I think it's something that could be worth looking at for animate.css, not at the library level.

A few ideas for how it could be solved:

Configurable distance
If some animations had a 'distance' prop which could just be any css value and unit. E.g.

:root {
  --animate-distance: ['20px', '100%', '3em', etc ];
}

@keyframes fadeInTop {
  from {
    opacity: 0;
    transform: translate3d(0, var(--animate-distance, 100%), 0); // fallback value if var isn't set
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

Range of classes
Some libraries probably wouldn't want to pass through a custom prop to inject into the css. A more lo-fi solution could be generating a range of classes for each animation. e.g. Way less flexible though.

@keyframes fadeInTop {  from {  ...   translate3d(0, 100%, 0) }....
@keyframes fadeInTop-50 {  from {  ...   translate3d(0, 50%, 0) }....
@keyframes fadeInTop-25 {  from {  ...   translate3d(0, 25%, 0) }....
@keyframes fadeInTop-10 {  from {  ...   translate3d(0, 10%, 0) }....

Thanks for the input... we will consider this.

@BeepBot99
Copy link

Is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request under consideration We might implement or accept this, but it still can be closed or denied v5
Projects
V5.0.0
To do
Development

No branches or pull requests

7 participants