Sign in to follow this  

bezier curve in a mask

Recommended Posts

I'm creating a mask for my sprite using a Phaser.Graphics object - the mask is a collection of rectangles and circles, and it works fine.


I then tried to add a filled bezier curve with the method bezierCurveTo(). If my graphics object is not set as a the mask, I can see the filled curve appear in my graphics. But when I use it as a mask for another sprite, the filled curve does not appear to be part of the shape



With mask applied - no bezier curve is seen



Plain graphics object, not used as a mask. The filled bezier curve is visible on the left.


Is this just a rule that bezier curves can't be used in masks? Or is there some other way to make this work...?



Share this post

Link to post
Share on other sites

Sadly this still doesn't work in 2.4.4, demo:

function create() {    var graphics2 =,0);    graphics2.beginFill(0xff0000, .5);    graphics2.drawRect(0,0, 800, 600);        var graphics =,0);    graphics.beginFill(0x00ff00, .5);    // boxes    graphics.drawRect(204-24,0, 24, 432);graphics.drawRect(12,484,128-12,24);// curve    graphics.moveTo(128,484);graphics.lineTo(128,508);graphics.quadraticCurveTo(204, 508, 204,432);graphics.lineTo(180,432);graphics.quadraticCurveTo(180, 484, 128,484);graphics2.mask = graphics;}

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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.