Skip to content

Instantly share code, notes, and snippets.

@nasser
Created December 18, 2010 05:35
Show Gist options
  • Save nasser/746199 to your computer and use it in GitHub Desktop.
Save nasser/746199 to your computer and use it in GitHub Desktop.
Undulating worm/3D effect Sketch
t = 0
setup do
# smoothing true
alpha_blending true
circle_resolution 64
background 0
title "Wormsign"
framerate 60
width 500
end
draw do
color 255
t += 0.1
80.times do |n|
n *= 0.1
disc 130+n*30+sin(t+n)*40, 230+sin(t+n)*40, 40+cos(n)*10, 5
end
end
def disc x, y, r, res
res.times do |n|
p = n/res.to_f
q = 1-p
color 0, 40*p
circle x, y, (r*1.5)*q
end
color 230, 25, 25
circle x, y, r
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment