This is a mighty amount of Javascript just to animate a button! Before reaching for JS for something visual I always have a real crack at a CSS only approach. Aside from your auto-rainbow setup which is a bit tricky, I was able to quickly setup your examples in CSS, and a lot fewer lines of code at that! Check it out!
That is a fair alternative but it doesn't exactly replicate the effect of the colors themselves by RGB values - I think both look good, but the visual effect they achieve is different. Hopefully CSS will eventually support smooth transitions at some point when using gradients natively.
For visuals I always try to go with a CSS approach. Though if you're aiming for something striking more than functional, the JS approach is much more appealing.
Both are good solutions, and I appreciate both of you taking the time to create the examples and share the code. :)
This is a mighty amount of Javascript just to animate a button! Before reaching for JS for something visual I always have a real crack at a CSS only approach. Aside from your auto-rainbow setup which is a bit tricky, I was able to quickly setup your examples in CSS, and a lot fewer lines of code at that! Check it out!
jsbin.com/jocebucoyi/edit?html,css...
That is a fair alternative but it doesn't exactly replicate the effect of the colors themselves by RGB values - I think both look good, but the visual effect they achieve is different. Hopefully CSS will eventually support smooth transitions at some point when using gradients natively.
For visuals I always try to go with a CSS approach. Though if you're aiming for something striking more than functional, the JS approach is much more appealing.
Both are good solutions, and I appreciate both of you taking the time to create the examples and share the code. :)
thank you carlos!