Created
January 24, 2018 15:53
-
-
Save szeryf/7674c3615697d6ec0d117f72f1976f5e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
W = 500 | |
H = 585 | |
W1 = W - 1 | |
H1 = H - 1 | |
def setup | |
@img = load_image '../scratch/girl.png' | |
@img.filter BLUR, 3 | |
@img.load_pixels | |
end | |
def draw | |
b = color('#36465d') | |
w = color(255) | |
load_pixels | |
max = 2000 | |
m = Hash.new((frame_count % 32) * (max / 32.0)) | |
i = 0 | |
0.upto(H1) { |y| | |
0.upto(W1) { |x| | |
c = @img.pixels[i] | |
m[y] += brightness(c) | |
if m[y] > max | |
pixels[i] = w | |
m[y] -= max / 2 | |
else | |
pixels[i] = b | |
end | |
i += 1 | |
} | |
} | |
update_pixels | |
end | |
def settings | |
size W, H, JAVA2D | |
smooth | |
end |
Thanks! This is awesome! I made a little JavaScript version in case that helps you understand @RamiAwar: http://bl.ocks.org/duhaime/f80c120feee59f136dd72b0a6582431e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I understand nothing ._. What libraries are used here? Never seen them before! Were you inspired by something for creating this? Where did the idea come from? It's amazing!