AlphaGradient Mask doest work (openfl)

Hello Im trying to make a alpha gradient mask - as mirror (openfl)

    var data:BitmapData = new BitmapData(Std.int(object.width), Std.int(object.height), true, 0);
	data.draw(object);
	var bit:Bitmap = new Bitmap(data, PixelSnapping.NEVER, true);
	holder.addChild(bit);

    var m:Matrix = new Matrix();
	m.createGradientBox(bit.width, h, Math.PI / 2);
	
	var msk:Shape = new Shape();
	msk.graphics.beginGradientFill("linear", [0xEEEEEE, 0xEEEEEE], [1, 0], [0, 200], m);
	msk.graphics.drawRect(0, 0, bit.width, h);
	msk.graphics.endFill();
	
	msk.y = object.y + h + distance;
	msk.x = object.x;
	msk.cacheAsBitmap = true;
	bit.cacheAsBitmap = true;
	bit.mask = msk;

No alpha applied :frowning: if i test it without masking - the gradient looks great…

1 Like

Alpha masking is not yet supported, but its a planned feature.

As a workaround, I would recommend using bitmapData.draw to convert your objects to BitmapData, then use bitmapData.copyChannel to copy the alpha channel from one object to the other

1 Like

@singmajesty any update for html5 gradient mask support?