zenozeng / p5.js-svg

SVG runtime for p5.js.
MIT License
680 stars 76 forks source link

Uncaught TypeError: color.indexOf is not a function (line 199) #204

Closed foundartfactory closed 2 years ago

foundartfactory commented 2 years ago

Hi there!

I'm receiving the error "Uncaught TypeError: color.indexOf is not a function (line 199 in p5.svg.js)" when trying to add a gradient. Also, the p5.js error is: "🌸 p5.js says: There's an error as "indexOf" could not be called as a function (on line 199 in p5.svg.js [http://localhost/~patrickcheatham/circlepacking-tests/p5/p5.svg.js:199:23])."

Please see my testing code below -- I'm not sure what I'm doing wrong. Ideas?

Many thanks in advance!

Patrick

let gradientStop1 = color('rgb(0,0,255)'); let gradientStop2 = color('rgb(255,70,255)');

let gradient = drawingContext.createLinearGradient(width/2-200, width/2-200, width/2+200, width/2+200); gradient.addColorStop(0, color('rgba(0, 0, 255, 1)')); gradient.addColorStop(1, color('rgba(190, 0, 255, 1)')); drawingContext.fillStyle = gradient;

ellipse(width/2, height/2, 600);

zenozeng commented 2 years ago
截屏2022-02-03 上午11 35 25
zenozeng commented 2 years ago

@foundartfactory Hi, this bug is fixed in p5.js-svg@1.3.0, you can try the latest version. A test case for this issue was also added:

截屏2022-02-04 下午2 25 07

.

foundartfactory commented 2 years ago

That’s great news! Many thanks!

Patrick

On Feb 3, 2022, at 22:25, Zeno Zeng @.**@.>> wrote:

@foundartfactoryhttps://github.com/foundartfactory Hi, this bug is fixed in @.***, you can try the latest version. A test case for this issue was also added: [截屏2022-02-04 下午2 25 07]https://user-images.githubusercontent.com/2544489/152482444-70d770e8-eef1-469a-941e-42a9bfe53d55.png .

— Reply to this email directly, view it on GitHubhttps://github.com/zenozeng/p5.js-svg/issues/204#issuecomment-1029695552, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXO52GONMJCKYZ53P3ODCQTUZNWPDANCNFSM5MZJCELA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>