aurelia / animator-css

An implementation of the abstract Animator interface from templating which enables css-based animations.
MIT License
45 stars 25 forks source link

Add toggleClass() to the animation abstraction #59

Open estaylorco opened 7 years ago

estaylorco commented 7 years ago

I'm submitting a feature request

Please tell us about your environment:

Current behavior: Presently, the animation abstraction offers up addClass() and removeClass(). This leads to code like this:

if (reveal) {
   this.animator.addClass(...);
else {
   this.animator.removeClass(...);
}

Not the end of the world, but a little verbose.

Expected/desired behavior: I would suggest a toggleClass() method on the abstraction. It is certainly in keeping with many of the animation libraries out there, including jQuery's, and it would allow the above to be reduced to:

this.animator.toggleClass(...);