Jump to content


Is there anyway to colorize/ desaturate a photo like in AS3 with JS?

Recommended Posts

Deos anyone know how I can use TweenMax to colorize a photo or desaturate one? Like on rollover of an image it would go from color to b&w? And is it possible to do without using 2 photos? One color and one black and white?


Looking for help.

Link to comment
Share on other sites



Take a look here http://www.pixastic.com/


Since it uses values and a function to set the colorize properties, you can tween those values and then pass them to the function and execute it using onUpdate to pass the values each time the tween updates.


It could be like this:


var colors =
greenImg : 0,
redImg : 0,
blueImg : 0
tn1 = TweenMax.to(colors, 1, {greenImg:1, onUpdate:updateFunction, paused:true});//to colorize it green

function updateFunction()
//pixastic code here



Hope this helps,



Link to comment
Share on other sites

Ok. In the latest version of Greensock it looks like filters are supported.


TweenMax.to($("#cycle"), .5, {css:{webkitFilter:"grayscale(1)"}});


This worked.


The downside is filters are only supported in webkit.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.