Last active
January 7, 2019 03:09
-
-
Save szeryf/64209d1088f5443268ca to your computer and use it in GitHub Desktop.
Code to go with: http://low-sugar-eye-candy.tumblr.com/post/133875924120/hey-man-i-really-love-your-work-how-did-you-come
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires jruby_art gem and Processing3 to run | |
# run with: k9 run --nojruby forest.rb | |
def setup | |
@images = Dir.glob("resized-*.jpg").map { |file| load_image(file) } | |
@pixels = @images.map { |i| i.load_pixels; i.pixels } | |
noise_seed 130 | |
end | |
def draw | |
sketch_title "frame #{frame_count}, #{frame_rate.to_i} fps" | |
image @images[0], 0, 0 if frame_count == 1 | |
load_pixels | |
sz = @pixels.size | |
psz = pixels.size | |
z = 1 + sin(frame_count / 10.0) | |
0.upto(psz - 1) do |i| | |
x = (i % 500) / 100.0 | |
y = (i / 500) / 100.0 | |
n = noise(x, y, z) | |
j = n * sz | |
pixels[i] = lerp_color(pixels[i], @pixels[(j + frame_count/TWO_PI) % sz][i], 0.3) | |
end | |
update_pixels | |
filter ERODE | |
if frame_count <= 20 * TWO_PI && frame_count > 10 * TWO_PI | |
saveFrame "#{Dir.pwd}/filename-###.png" | |
p saved: frame_count | |
end | |
end | |
def settings | |
size 500, 334, JAVA2D | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The effect: