17_Scale color

Feb 08, 2010 00:39






size(228, 154)

colormode(RGB, range = 255)

def scale_color(color, scale):
red, green, blue = color
red = red*scale
green = green*scale
blue = blue*scale
return red, green, blue

fireball = (221, 99, 20)
fill(fireball)
oval(150, 10, 60, 60)

fireball_scale1 = scale_color(fireball, 1.5)
fill(fireball_scale1)
oval(80, 10, 60, 60)

fireball_scale2 = scale_color(fireball, .5)
fill(fireball_scale2)
oval(10, 10, 60, 60)

# приводит saturation в норму(к 255)

def saturation_color(color):
red, green, blue = color
red = min(red, 255)
green = min(green, 255)
blue = min(blue, 255)
return red, green, blue

satball = (500, 99, 20)
fill(satball)
oval(150, 80, 60, 60)

satball1 = saturation_color(satball)
print satball1
fill(satball1)
oval(80, 80, 60, 60)

nodebox

Previous post Next post
Up