Fill the t-shirt with color and change the text color on the HTML canvas accordingly.

I have painted a t-shirt on canvas and I am currently trying to fill it when the user selects a color from the menu above. Also, I would like the text on the T-shirt to change accordingly (for example, if the color is black, the color of the T-shirt text should be white). Is it possible?

Snippet of code:

<body>T-shirt color
    <br>
    <canvas id="toolsCanvas" width=300 height=53></canvas>
    <br>
    <p>
        <canvas id="drawingCanvas" width="520" height="0"></canvas>
        <canvas id="itemCanvas" width="520" height="429"></canvas>
</body>

      

It would be easier to demonstrate what I'm talking about, the jsFiddle is here: http://jsfiddle.net/rtnq8mjL/

+3


source to share


1 answer


You have to use the methods ctx.fillStyle = color

and ctx.fill()

to fill the shirt. but somehow the shirt is not completely filled with color.

Here is a partially completed violin .



Hope you can fix this problem here.

+1


source







All Articles