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

Support animating icon changes #41

Open
karptonite opened this issue May 10, 2018 · 5 comments
Open

Support animating icon changes #41

karptonite opened this issue May 10, 2018 · 5 comments

Comments

@karptonite
Copy link

Is it possible to transform fontawesome icons with css using angular fontawesome? For example, I'd like to be able to define a class "active" that rotates all specified icons 90 degrees with a 0.2s transition. I could do that pretty easily with css when we were using glyphicons, but it for angular-fontawesome, the only way I've found to do it is with the "rotate" attribute, and I'm not sure how to animate the transition.

@robmadole
Copy link
Member

@karptonite you should be able to use CSS with angular-fontawesome too. Is there a reason why this won't work?

@LeonsBuntis
Copy link

It doesn't work with Just applying CSS style transition: transform 250ms;. Because the rotate function is not rotating existing DOM element using CSS, but deletes existing element and creates new element.

@devoto13
Copy link
Collaborator

Here is a working example: https://stackblitz.com/edit/angular-z8v4ux-9vvflc

The trick is to set class on the fa-icon components itself and also set display for it. Because by default Angular components don't have any display and therefore don't affect the display of their children.

@LeonsBuntis
Copy link

@devoto13 Thank you. But in your example you are not using rotate attribute provided by this libraries API, I thought It would be achievable that way.

@Bottlecaps4
Copy link

If you're referring to the fa-rotate-* class then all you need to do is to add transition: transform 2s; to the CSS class and it will animate the rotation. Toggling the fa-rotate-* class directly will animate the rotation directly to the icon.

@devoto13 devoto13 changed the title Transform with css? Support animating icon changes Aug 9, 2019
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

No branches or pull requests

5 participants