Search code examples
easeljscreatejs

EaselJS show portion of an image


I am trying to display a progressbar using EaselJS. My progressbar background-image is 200px, and fully displaying that would mean the progress is at 100%. How can I show only draw a percentage of an image in EaselJS? And is it possible to animate/tween towards more %?


Solution

  • You are looking for a mask: http://www.createjs.com/Docs/EaselJS/classes/DisplayObject.html#property_mask

    Here is an example on how a mask could be used: https://github.com/CreateJS/EaselJS/blob/master/examples/Masks.html