[SOLVED] [HTML5 Target] BlendMode not working

I’m adding a Sprite with a bitmap inside to the stage, than i change blendMode to SCREEN.
Nothing happens on HTML5 targets while on flash everything works fine…
OPENFL Wiki says “Available on all platforms” (link)

Am I doing something wrong?

Here is the code im using:

var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xff0000, 1);
sp.graphics.drawCircle(200, 200, 100);
sp.graphics.endFill();
addChild(sp);

var bmd:BitmapData = Assets.getBitmapData("img/1.jpg");
var b:Bitmap = new Bitmap(bmd);
b.blendMode = BlendMode.SCREEN;

addChild(b);

Imporets are:

import openfl.Assets;
import openfl.display.BitmapData;
import openfl.display.Bitmap;
import openfl.display.BlendMode;
import openfl.display.Sprite;

Flash Target:

HTML5 Target:

1 Like

As far as I know, HTML5 canvas doesn’t have BlendMode support, HTML5 webGL does. Try compiling it with lime test html5 -Dwebgl

1 Like

Thanks @mrcdk ! That worked great.
Is there anything that stops working once i use webgl?

It’s been a work-in-progress, WebGL uses the same desktop GL renderer that has been improving in OpenFL (the default one, not legacy), which step-by-step has continued to get better. Let us know how it works for you :slight_smile: