Skip to content

Instantly share code, notes, and snippets.

@szeryf
Created January 24, 2018 15:53
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save szeryf/7674c3615697d6ec0d117f72f1976f5e to your computer and use it in GitHub Desktop.
Save szeryf/7674c3615697d6ec0d117f72f1976f5e to your computer and use it in GitHub Desktop.
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
@RamiAwar
Copy link

RamiAwar commented Aug 3, 2018

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!

@duhaime
Copy link

duhaime commented Nov 17, 2018

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