Tween any DisplayObject to Black and White, or from Black&White to Color


/ Published in: ActionScript 3
Save to your folder(s)

I'm going to use TweenLite for this;

We need to import the ColorMatrixFilterPlugin and register it


Copy this code and paste it in your HTML
  1. //Tweens to black and white
  2. TweenLite.to(DisplayObjectYouWantToTween ,1,{colorMatrixFilter:{matrix:[0.3,0.59,0.11,0, 0,0.3,0.59,0.11,0,0,0.3,0.59,0.11,0,0,0,0,0,1,0]}});
  3.  
  4. //Tween from black and white to Color
  5. TweenLite.to(DisplayObjectYouWantToTween,1,{colorMatrixFilter:{matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]}});
  6.  
  7.  
  8. /*
  9. Note you need to import TweenLite's ColorMatrixFilterPlugin and register it :)
  10. */

URL: tween, black, white,

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.