Copy link to clipboard
Copied
Hello, I have situation - presently rebuilding the project from AS3 to HTML5 Canvas. I need some advise how can I change color of Movie Clip with code ?
Code in AS3:
komodamenu1_mc.spalv81_btn.addEventListener(MouseEvent.CLICK,komoda81);
function komoda81(event:MouseEvent):void {
var myColorTransform:ColorTransform = new ColorTransform()
myColorTransform.color = (0xdab396);//RAL 1001
komoda1_mc.transform.colorTransform=myColorTransform
}
The Live flash version: https://bilijardai.lt/sites/default/files/SWF%20failai/Pronto%20Ultra/Bill%20ULTRA%20konstr%202017_1...
Copy link to clipboard
Copied
https://www.createjs.com/docs/easeljs/classes/ColorFilter.html
Note that the HTML5 canvas element doesn't natively support filter effects, so they must be implemented pixel-by-pixel in JavaScript. This can be rather slow depending on the size of the image.
Copy link to clipboard
Copied
if it's a shape you can easily change the shape color inside a movie clip using the code below
Copy link to clipboard
Copied
Hello, thank you for reply. I made the sample with shape and put your suggested code - it doesn't work.
Can you send me any working sample on An with code?
Copy link to clipboard
Copied
Filters just kill the performance in my CC Animate (HTML Canvas) project. I learend to stay away from them. If I need a cool (static) filter effect, I just import an image with the content and the filter. (HTML Canvas) works well with bitmaps,but not programmatically adding filters