Search code examples
javascripthtmlcanvaskineticjs

how can i add a background color to a layer kineticjs?


How can I add a background color to a layer in kineticjs? I want to have multiple layers which have different background colors.

Something like:

var layer = new Kinetic.Layer({
                x: 0,
                y: 0,
                width : that.locationData.getCreativeLeftLoc(),
                height : that.locationData.getCreativeTopLoc(),
                background-color : 'black'
            });

Solution

  • You can't. See the docs.

    It goes Node > Container > Layer, none of which support drawing to themselves. They serve only to group other kinetic objects.