Jump to content

(Solved) [HTML Canvas]: CSS hue-rotate filter in JS only works when not animated


kp123
 Share

Recommended Posts

Code: https://codepen.io/kristianpedersen/pen/JBMNyZ

My Canvas drawing uses two CSS filters inside the JS code: a hue rotate and a drop shadow.

It works fine when it's not animated, but as soon as I uncomment requestAnimationFrame (line 16), the hue rotate (line 34) stops working, while the shadow filter still works.

I only need it to work on my machine, so browser compatibility isn't an issue.

Of course, I can color the circle using a separate fillStyle call, but I thought this was a cool way of doing things. Any other comments about the code would also be appreciated. Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...