BlenMode.ERASE not working

#1

Hello, I try to use BlenMode.ERASE but it’s not working

var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0x00FF00);
sprite.graphics.drawRect(0, 0, 100, 100);
sprite.graphics.endFill();
sprite.blendMode = BlendMode.LAYER;

var shape:Shape = new Shape();
shape.graphics.beginFill(0x000000);
shape.graphics.drawRect(10, 10, 80, 80);
shape.graphics.endFill();
sprite.addChild( shape );
shape.blendMode = BlendMode.ERASE;
this.addChild(sprite);

Thanks

0 Likes

#2

I don’t think we can do this in GL, or even canvas, I think.

We should have a way to get better documentation on what’s implemented, and what’s a polyfill :frowning:

0 Likes

#3

How to use BlendMode.ERASE ?

0 Likes

#4

Can you use a scrollRect or mask to achieve a similar effect?

0 Likes

#5

I need to use an inverted mask, for this it’s necessary to use BlendMode.ERASE, a year ago it working on html ?

0 Likes

#6

I’m not aware of that, but perhaps it would be possible to implement (internally) by rendering as a mask instead

0 Likes

#7

Hi. Is it possible to invert a mask/use a mask inverted without writing a custom shader or hacking the framework?

0 Likes

#8

Perhaps there may be a way to make BlendMode.ERASE trigger one – this would require work internally to OpenFL, but could make a good pull request

0 Likes

#9

I installed Starling/OpenFL for BlendMode.ERASE (Lemmings digging into the ground). Wanted to try it anyways.

But maybe it really should be possible in OpenFL alone too. :wink:

0 Likes