Slava Knyazev
Slava Knyazev

Reputation: 6081

Continuously change hue of image

Is there a way to have the image change Hue – from -180 through 180 - in, say, 20 seconds? If so then having that process/script repeat/loop indefinitely?

Upvotes: 0

Views: 679

Answers (1)

Zenexer
Zenexer

Reputation: 19613

There are a few methods that you could try. The most compatible would probably be SVG or canvas. There are libraries for manipulating SVG images with JavaScript, and there's lots of documentation on canvas on MDN.

Though support is limited as of writing, in the future you'll be able to use the new CSS filter property. You can combine that with CSS @keyframes to create animation with very little JavaScript, which would be pretty awesome. Specifically, you'll want to look at the hue-rotate function for filter.

Upvotes: 2

Related Questions