Fish Eye Sketch in JRubyArt
Another openprocessing sketch by Michael Pinn
# After an openprocessing sketch
# by Michael Pinn
# translated to JRubyArt by Martin Prout
# make use of built in grid and DegLut utilities
def settings
size(640, 640)
end
def setup
sketch_title 'Fish Eye Grid'
noStroke
fill(234, 46, 73)
end
def draw
background(51, 55, 69)
translate(width / 2, height / 2)
# The amount of layers
grid(120, 360, 20, 30) do |j, q|
h = j * 2 + 5
# The amount of shapes per layer
x2 = DegLut.sin(q + h) * j
y2 = DegLut.cos(q + h) * j
delta = map1d(dist(x2, y2, 0, 0), 0..120, 0..360).floor
push_matrix
translate(x2, y2)
scale(map1d(j, 0..180, 0.1..0.4))
rotate((-q - h).radians)
begin_shape
# The shape, made from openprocessing.org/sketch/162912
(0..180).step(5) do |i|
calc_vertex(i, delta)
end
36.downto(0) do |z| # no negative step
calc_vertex(z * 5, delta, -1)
end
end_shape(CLOSE)
pop_matrix
end
# save_frame(data_path('####.png'))
end
def calc_vertex(angle, delta, sign = 1)
phi = sign * DegLut.sin(angle) * angle / 3
theta = DegLut.sin((angle + frame_count * 3 + delta)) * 50
vertex(phi - theta, angle * 2)
end
Animated gif
Capture png images and knit them together (it’s so easy on linux)
cd data
convert -delay 2 -loop 0 *.png animation.gif