2021-02-18 19:39:11 +00:00
|
|
|
import pixie
|
2021-02-14 04:45:27 +00:00
|
|
|
|
2021-02-18 22:40:35 +00:00
|
|
|
let image = newImage(200, 200)
|
2021-02-14 04:45:27 +00:00
|
|
|
image.fill(rgba(255, 255, 255, 255))
|
|
|
|
|
2021-02-18 22:40:35 +00:00
|
|
|
let polygonImage = newImage(200, 200)
|
2021-05-21 04:48:59 +00:00
|
|
|
|
|
|
|
let ctx = newContext(polygonImage)
|
|
|
|
ctx.fillStyle = rgba(255, 255, 255, 255)
|
|
|
|
|
|
|
|
ctx.fillPolygon(
|
2021-02-18 22:40:35 +00:00
|
|
|
vec2(100, 100),
|
|
|
|
70,
|
2021-05-21 04:48:59 +00:00
|
|
|
sides = 8
|
2021-02-18 22:40:35 +00:00
|
|
|
)
|
2021-02-14 04:45:27 +00:00
|
|
|
|
2021-02-19 18:04:27 +00:00
|
|
|
let shadow = polygonImage.shadow(
|
2021-02-14 04:45:27 +00:00
|
|
|
offset = vec2(2, 2),
|
|
|
|
spread = 2,
|
|
|
|
blur = 10,
|
|
|
|
color = rgba(0, 0, 0, 200)
|
2021-02-19 18:04:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
image.draw(shadow)
|
2021-02-18 22:40:35 +00:00
|
|
|
image.draw(polygonImage)
|
2021-02-14 04:45:27 +00:00
|
|
|
|
|
|
|
image.writeFile("examples/shadow.png")
|