Highlighted

Change color of a Movie Clip in an Animate Canvas document

New Here ,
Apr 08, 2020

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

Views

272

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Change color of a Movie Clip in an Animate Canvas document

New Here ,
Apr 08, 2020

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

Views

273

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 08, 2020 0
Adobe Community Professional ,
Apr 08, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 08, 2020 0
Community Beginner ,
Apr 08, 2020

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

mc.shape.graphics._fill.style "#3399CC"  // with no stroke
mc.shape_1.graphics._fill.style "#3399CC" //with stroke
 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 08, 2020 0
New Here ,
Apr 21, 2020

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 21, 2020 0
Community Beginner ,
Apr 08, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 08, 2020 0