doppler

Easeljs - Mask & Subtract Front Shape

Recommended Posts

Does anybody know how to subtract the alpha values from a shape? After hours of research, my best bet is to utilize an alpha filter (link) The current Shape.mask value does not seem to have an easy way to invert masks (link)

Example of what I want to achieve:

KUkTKyi.png

Share this post


Link to post
Share on other sites

I have not yet worked with the alpha filters but for a normal mask I don't think there is an easy way of doing it. I would probably have made the inverted mask in Flash IDE and then exported it with Toolkit For CreateJS. That is, the exported mask would be a big rectangle with a cut out circle in the middle. A 100x100 rect with a 33 diameter circle in the middle produces the following code:

 

	this.shape = new cjs.Shape();
	this.shape.graphics.beginFill("rgba(255,255,255,0.761)").beginStroke().moveTo(-50,50).lineTo(-50,-50).lineTo(50,-50).lineTo(50,50).closePath()
	.moveTo(-12.2,-12.1).curveTo(-17,-7.3,-17,-0.5).curveTo(-17,6.4,-12.2,11.1).curveTo(-7.3,16,-0.5,16).curveTo(6.4,16,11.1,11.1).curveTo(16,6.4,16,-0.5).curveTo(16,-7.3,11.1,-12.1).curveTo(6.4,-17,-0.5,-17).curveTo(-7.3,-17,-12.2,-12.1).closePath();
	

    

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.