""" Rory Solomon Code Toolkit: Python Example of using map() """ def setup(): size(400, 400) def draw(): background(255) strokeWeight(1) stroke(0) noFill() rect( 5, 150, 10,100) strokeWeight(10) stroke( 55, 55, 255) line( 10, mouseY-10, 10, mouseY+10) strokeWeight(1) fill(155, 155, 255, 150) y1 = map( mouseY, 0, height, 150, 250) rect( 200, y1, 50,50) y2 = map( mouseY, 0,height, 250,150) ellipse( 250, y2, 50,50) x1 = map( mouseY, 150, 250, 200,width) triangle( x1,350, x1,375, x1+25,375) size1 = map( mouseY, 150, 250, 25,200) ellipse( 50, 350, size1,size1) amt = map( mouseY, 150, 250, 0,1) c1 = color(255,55,55,100) c2 = color(55,255,55,100) c = lerpColor( c1, c2, amt) fill(c) noStroke() ellipse(300,100,75,75) ellipse(350,110,30,30) ellipse(300,50,30,30) ellipse(350,75,50,50) ellipse(275,50,20,20)