Jump to content

Using ColorMatrixFilter to tint to white and back to normal


wograebn
 Share

Recommended Posts

I would like to make an image go from normal -> fully white -> back to normal. Imagine for example shooting at an enemy in a game, and you want them to flash white briefly. I'm trying to use ColorMatrixFilter for this.

This will make the image show up as normal

colorMatrix = [
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
  ];

This will make the image show up as fully white

colorMatrix = [
    1, 1, 1, 0,
    1, 1, 1, 0,
    1, 1, 1, 0,
    0, 0, 0, 1
  ];

My problem is blending inbetween, when the blend is halfway the image appears desaturated. Any way I can use colormatrixfilter to achieve the effect I am after?

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...