Jump to content
Search Community

Animate 2020 AlphaGradientMask Animation

12704_1494126580 test
Moderator Tag

Recommended Posts

I am trying to animate the mask_mc from left to right using TimelineMax. I need a simple setup to set the position then move it across. Help is greatly appreciated.

 

var mask_mc = this.mask_mc;
var maskedContent = this.maskedContent;


//AlphaGradientMask
maskedContent.filters = [
    new createjs.AlphaMaskFilter(mask_mc.cacheCanvas)
];

maskedContent.updateCache();

// create timeline
var tl = new TimelineMax();


tl.to(mask_mc.getChildAt(0), 3,{x:400, onUpdate:updateMask}, 'start')


//AlphaMaskFilter needs to be updated on every tick if it has to tween.
function updateMask(){
    mask_mc.updateCache();
    exportRoot.maskedContent.filters = [
        new createjs.AlphaMaskFilter(mask_mc.cacheCanvas)
    ];

    exportRoot.maskedContent.updateCache();
    console.log('updating');
}

Link to comment
Share on other sites

Welcome to the forums, @12701_1494126580 (interesting username :) )

 

This sounds like much more of an Adobe Animate question, not GSAP. I'm not familiar with how Animate 2020 works in terms of masks, but you should certainly be able to animate any property with GSAP. I'd recommend maybe asking in the Adobe Animate community (these forums are focused on GSAP-specific questions). 

 

Good luck with the project!

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

I've already used that code in Animate CC, some things that can be forgotten:

  • both your "maskedContent" and "mask_mc" have to be a movieclips cashed as bitmap for it to work.
  • don't forget to call createjs
  • position and sizing of the elements can be tricky, sometimes you think it doesn't work but it's just because your mask isn't at the good position
  • Like 2
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.
×
×
  • Create New...