Jump to content

bezier curve in a mask


richpixel
 Share

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

 

mask.png

With mask applied - no bezier curve is seen

 

nomask.png

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...?

 

 

Link to comment
Share on other sites

  • 9 months later...

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

function create() {    var graphics2 = game.add.graphics(0,0);    graphics2.beginFill(0xff0000, .5);    graphics2.drawRect(0,0, 800, 600);        var graphics = game.add.graphics(0,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;}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...