Jump to content


how to animate a mask?

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,


I'm exploring the possibilities of animating with GSAP in javascript after doing it for years in Flash. While discovering the nuances are fun, I'm finding the edges where Flash made it somewhat easier.... at least for now!


I'm trying to recreate an animation I did in Flash but in Javascript. Essentially, it's a masked image that it "scratched" off to reveal an image underneath. Think of a lottery ticket with the silver scratch off stuff... I'd like to animate the reveal with a swiping motion.


Any help/ideas on how I would best approach this? A quick google search for animating masks in Javascript turns up alot of SVG usage but I'd like to know how to do this with GSAP.


thanks in advance for any thoughts!

Link to comment
Share on other sites



The best minds have weighed in on masking here:



Unfortunately what you described is not really available for basic DOM elements. GSAP can be combined with many different technologies and tools: canvas, svg (see raphael.js), three.js, webGL etc. If another existing technology supports masking, there is a very good chance that you can animate the updating/rendering of that mask with GSAP.

Link to comment
Share on other sites

Thanks, Carl. I was afraid a "Flash-like" solution might involve several technologies. I'll keep researching...

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.