Skip to content

Instantly share code, notes, and snippets.

@typemytype
Created November 27, 2020 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typemytype/bca42c7d08e5306934fc07e7b2687131 to your computer and use it in GitHub Desktop.
Save typemytype/bca42c7d08e5306934fc07e7b2687131 to your computer and use it in GitHub Desktop.
x, y = 0, 0
w = h = 200
circles = 3
offset = 20
thickness = 26
color1 = (0, 1, 1)
color2 = (1, .5, 0)
color3 = (1, 0, 1)
color4 = (1, 1, 0)
colorMap = [
(x, y, color1),
(x + w, y, color2),
(x, y + h, color3),
(x + w, y + h, color4),
]
size(w, h)
for cx, cy, color in colorMap:
fill(*color)
oval(cx-thickness, cy-thickness, thickness*2, thickness*2)
blendMode("multiply")
path = BezierPath()
for i in range(circles):
factor = i / (circles - 1)
inset = offset + (w / 2-offset*2) * factor
path.oval(x+inset, y+inset, w-inset*2, h-inset*2)
path = path.expandStroke(thickness)
clipPath(path)
for cx, cy, color in colorMap:
radialGradient((cx, cy), (cx, cy), [color, (1, 1, 1, 0)], startRadius=0, endRadius=w)
rect(x, y, w, h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment