Shadow implementation

edited March 2015 in p5.js

Hi all, I'm looking for shadow implementation for shapes. Something like this http://www.html5canvastutorials.com/advanced/html5-canvas-shadow-offset-tutorial/ by more in p5-way. Can anybody suggest something?

Answers

  • there's no built in p5.js method, but you can call html5canvas methods by using the drawingContext variable. something like this:

      fill(255, 0, 0);
      rect(0, 0, 200, 100);
      drawingContext.fillStyle = 'red';
      drawingContext.shadowColor = '#999';
      drawingContext.shadowBlur = 20;
      drawingContext.shadowOffsetX = 15;
      drawingContext.shadowOffsetY = 15;
      drawingContext.fill();
    
Sign In or Register to comment.