2d-inc / Flare-JS

Flare Javascript ES6 runtime with Canvas rendering.
https://flare.rive.app
MIT License
265 stars 59 forks source link

Color Components don't update #10

Open umberto-sonnino opened 5 years ago

umberto-sonnino commented 5 years ago

I've noticed that ColorComponents aren't updating properly in the runtime, as they are not marked dirty on their own.

So for example: a static Rectangle with a gradient fill won't change its color/opacity. On the other hand, if the rectangle is also animating the transform, it'll be updated through the transform dirt flag.

Here's an example file: Simple.Shapes.flr.zip Which is this file.

A solution would be to add a new function to ActorPaint

class ActorPaint extends ActorComponent 
{
[...]
    markDirty()
    {
        this._Actor.addDirt(this, ColorDirty, true);
    }
[...]
}

Which then can be called in Animation.apply() when a ColorComponent is modified. I've tested this locally and it works.

IsaaacD commented 3 years ago

I tried the shapes-2 file in the example and it shows just a blank screen. Is there something additional that needs to be setup to get this to work?