Skip to content

Instantly share code, notes, and snippets.

@dangpzanco
Forked from szeryf/line_girl.rb
Created August 3, 2018 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangpzanco/7fb9fc1c32ef0b8ba2be7417bdc19165 to your computer and use it in GitHub Desktop.
Save dangpzanco/7fb9fc1c32ef0b8ba2be7417bdc19165 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment