In my p5.js code, I created a rectangle using rect()
:
rect(10, 10, 10, 10);
Now, I want to add some style to it with a box-shadow effect:
box-shadow: 20px 20px 50px #00d2c6,
-30px -30px 60px #00ffff;
However, when I tried to apply the style using the documentation's method:
let testSquare = rect(10, 10, 10, 10);
testSquare.style('box-shadow: 20px 20px 50px #00d2c6,');
testSquare.style('-30px -30px 60px #00ffff;') ;
I encountered an error:
platformer.js:7
Uncaught TypeError: testSquare.style is not a function
at draw (platformer.js:7)
at p5.redraw (p5.js:49679)
at p5.<anonymous> (p5.js:44342)
at p5.<anonymous> (p5.js:44236)
at new p5 (p5.js:44525)
at _globalInit (p5.js:46308)
If anyone knows how to solve this issue and successfully style the rectangle, please share your insights.