| Start |
|---|
| Sticker effect using shadows This code adds outwardly increasing shadows to an image to create a "sticker" version of the image. Notes:
|
| How to stop further shadowing Once shadowing is turned on, every new drawing to the canvas will be shadowed. Turn off further shadowing by setting |
| Shadowing is computationally expensive -- Cache that shadow! Warning! Apply shadows sparingly! Applying shadowing is expensive and is multiplicatively expensive if you apply shadowing inside an animation loop. Instead, cache a shadowed version of your image (or other drawing): |
| Add visual depth with shadows The traditional use of shadowing is to give 2-dimensional drawings the illusion of 3D depth. This example shows the same "button" with and without shadowing |
| Inner shadows Canvas does not have CSS's
But it's easy to create inner-shadows using compositing. Strokes with an inner-shadowTo create strokes with an inner-shadow, use
Stroked Fills with an inner-shadowTo create fills with an inner-shadow, follow steps #1-3 above but further use
Non-stroked Fills with an inner-shadowTo draw a filled shape with an inner-shadow, but with no stroke, you can draw the stroke off-canvas and use |
Read Article
https://develop.horje.com/learn/1434/reference