Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@RamiAwar 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

This comment has been minimized.

Copy link

@duhaime 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