P5.js: Shadows for p5

Created on 20 Aug 2018  路  5Comments  路  Source: processing/p5.js

Nature of issue?

  • [ ] Found a bug
  • [ ] Existing feature enhancement
  • [x] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [x] Core/Environment/Rendering
  • [ ] Data
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Other (specify if possible)

New feature details:

Currently p5.js does not have any support for shadows. It's one of the very few things missing and should be relatively easy to implement too! This links to the documentation about shadows.

It would be great if a method could be added to allow the user to create shadows with ease. Perhaps multiple methods could be created to change specific properties of the shadows, though I'm unsure as to how useful that might truly be. Hoping this issue can be a space for discussion about this.

In case the community believes that this would be a useful addition, I've written some code for a method for creating shadows, hopefully that can be a good start!

Most helpful comment

An example in the documentation would be very helpful - I don't know how to "call these methods natively on the canvas object" and I would expect the average p5js user to not be familiar with it either.

All 5 comments

I'm not seeing a lot of response around this one right now and I think it may be beyond the scope of the library for now. It is possible to call these methods natively on the canvas object, so I'm not sure a wrapper of these is necessary. Let's revisit in the future if others express the same need. Thanks @TanviKumar

@TanviKumar
Do you have an example of using "drop shadows" in 2D art?
New to p5.js and working on an assignment. I would like to add depth to it. Any help?
Thanks!

An example in the documentation would be very helpful - I don't know how to "call these methods natively on the canvas object" and I would expect the average p5js user to not be familiar with it either.

@jatin33 maybe you'd like to look at this one?

Adding shadow to objects is easy :

var context = drawingContext; // or p5.drawingContext
context .shadowOffsetX = 5;
context .shadowOffsetY = -5;
context .shadowBlur = 10;
context .shadowColor = '#FFF';

Was this page helpful?
0 / 5 - 0 ratings

Related issues

b0nb0n picture b0nb0n  路  3Comments

dhowe picture dhowe  路  3Comments

bassamanator picture bassamanator  路  3Comments

aferriss picture aferriss  路  3Comments

slowizzm picture slowizzm  路  3Comments