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

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.