Skip to content

Instantly share code, notes, and snippets.

@bencrowder
Created September 6, 2014 15:30
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 bencrowder/a5cdd81e75c93190fe3b to your computer and use it in GitHub Desktop.
Save bencrowder/a5cdd81e75c93190fe3b to your computer and use it in GitHub Desktop.
PlotDevice watersun demo
# For PlotDevice (plotdevice.io)
# This code is crappy. It's hastily thrown together prototype code and shouldn't
# be used in anything remotely resembling a production environment.
# Originally modeled after some code in the PlotDevice manual (http://plotdevice.io/tut/Geometry)
CIRCLE_CENTER_X = 200
CIRCLE_CENTER_Y = 200
INNER_CIRCLE_RADIUS = 100
INNER_STEP = 15
NUM_INNER_LINES = 20
size(CIRCLE_CENTER_X * 2, CIRCLE_CENTER_Y * 2)
stroke(0)
fill(None)
pen(5)
path = arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, INNER_CIRCLE_RADIUS)
pen(1)
path = arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, INNER_CIRCLE_RADIUS + 5)
pen(0.5, cap=SQUARE)
for t in range(30):
curve = path.point(t/30.0)
a = curve.angle(curve.ctrl2)
with transform(CORNER):
translate(curve.x, curve.y)
rotate(-a+90)
line(0, 0, 10, 0)
line(10, 0, 10, -2)
line(10, -2, 15, -2)
line(15, -2, 15, 2)
line(15, 2, 20, 2)
line(20, 2, 20, 0)
line(20, 0, 35, 0)
pen(1)
stroke(RGB, 0.5, 0.8, 1.0)
with clip(arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, INNER_CIRCLE_RADIUS - 3)):
with translate(CIRCLE_CENTER_X, CIRCLE_CENTER_Y).rotate(3):
for i in range(0, NUM_INNER_LINES):
translate(0, INNER_CIRCLE_RADIUS / NUM_INNER_LINES)
bezier([(-INNER_CIRCLE_RADIUS, 0), (-INNER_CIRCLE_RADIUS/2, -10), (0, 0), (INNER_CIRCLE_RADIUS/2, 10), (INNER_CIRCLE_RADIUS, 0)], smooth=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment