Heres a processing sketch I found over at biothing.org that I've given the ruby treatment.
##################################################
# amp_zoom_in.rb
# adapted from a sketch at http://www.biothing.org
##################################################
attr_reader :col, :a, :b, :c, :k, :amp, :time
def setup()
size(320, 240, P3D)
color_mode(RGB, 1.0)
frame_rate(4)
load_pixels()
@time = 0
@k = 0
end
def draw()
@time += 0.1 #step ahead in time with each frame
#now go through each pixel in the window:
(0...width).each do |x|
(0...height).each do |y|
#create values with trig functions, noise, etc acting on x,y and time.
#experiment with how these values are modulating over time.
@a = dist(x,y,width/2,height/2)
@b=(cos(x/360.0 + time)).abs # frequency larger # means less
@c = noise(y/180.0*cos(time/20.0)) # inteference larger # means less
@amp = k # amplitude
@col = color((cos(a/120.0 + b + c * 10.0).abs)) * amp
#combine values into a color somehow. again the possibilities are limitless
set(x, y, col)
end
end
update_pixels()
@k += 1
end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Thursday, 15 April 2010
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2010
(73)
-
▼
April
(10)
- Using the Voronoi library in ruby processing
- Moire patterns from custom bar shape Context free DSL
- Faux barcode using ruby-processing Context Free DSL
- Adding a custom terminal in ruby-processing contex...
- How to Draw a Tree in Processing
- Terse Code to use file chooser in Ruby Processing
- Another funky random sketch with perlin noise
- An Translation Exercise (Very Clever Pseudo 3D Ani...
- Live Editing Ruby-Processing from jEdit
- Plasma fractal (and carpet)
-
▼
April
(10)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment