xxxxxxxxxx
35
function drawBox(x, y, w, h, angle){
push()
rectMode(CENTER)
translate(x+w/2, y+h/2)
rotate(angle)
rect(0, 0, w, h)
pop()
}
let temp = 72
const freeze = 32
const boil = 212
function setup() {
createCanvas(200, 200);
angleMode(DEGREES)
textAlign(CENTER)
noStroke()
fill(0)
}
function draw(){
background(255)
let angle = map(temp, freeze, boil, 0, 90)
drawBox(50, 90, 100, 25, angle)
text(temp, 100, 180)
temp += 1
if (temp > boil){
temp = freeze
}
}