-
-
Save dangpzanco/7fb9fc1c32ef0b8ba2be7417bdc19165 to your computer and use it in GitHub Desktop.
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment