Search code examples
alphashadowcreatejs

createjs.Shadow alpha


Can the alpha of a drop shadow created with createjs.Shadow be controlled independently of the object it's attached to? I tried, simply:

myObject.shadow = new createjs.Shadow("#000000",200,200,15);
myObject.shadow.alpha=0.2;

But that's a no go. Can't find anything in the API docs, but those are all pretty damn confusing to begin with.


Solution

  • You can change the alpha of a shadow by adjusting the alpha of the fill color it uses. For example:

    myObject.shadow = new createjs.Shadow("rgba(0,0,0,0.2)",200,200,15);
    

    It might also be worth taking a look at Graphics.getRGB().