Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fillStyle not a function

I'm getting an unusual error:

ctx_wrap.fillStyle is not a function

on this line:

ctx_wrap.fillStyle('#b8b8b8');

in here:

...
this.paint = function() {
    self.path(ctx_wrap);
    if (!isOver) {
        ctx_wrap.fillStyle('#b8b8b8');
    } else {
        ctx_wrap.fillStyle('#d6d6d6'); 
    }
    ctx_wrap.fill()
    ctx_wrap.stroke();
};
...

What is strange is that, if I comment out that line, the line beneath works. These two lines are nearly identical, but the first one produces the error and the second one works:

ctx_wrap.fillStyle('#b8b8b8');
ctx_wrap.fillStyle('#d6d6d6');

Why would the first line produce the error?

like image 843
Michael Gaio Avatar asked Apr 13 '26 18:04

Michael Gaio


1 Answers

Try using ctx_wrap.fillStyle = "#COLOR".

The second one does not work, the console just stops at the first one and spits out the error, because it freaked out from the line of code.

like image 154
Assafi Cohen-Arazi Avatar answered Apr 15 '26 10:04

Assafi Cohen-Arazi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!