xxxxxxxxxx
34
/*
ArtistWhoCode practices - 1.0
- draw() example 에 응용
- 색상 변환 추가
refs
- https://www.youtube.com/watch?v=emHEaQSrxR4&list=PLUm8BKCCLrpchGRrtdaTAPXfDe3lOeHMp&index=1
*/
let yPos = 0;
function setup() {
frameRate(60);
createCanvas(400, 400);
}
function draw() {
// draw() loops forever, until stopped
const color = yPos / height * 256;
background(256 - color, color, color);
yPos = yPos - 1;
if (yPos < 0) {
yPos = height;
}
stroke(color, 256 - color, color);
line(0, yPos, width, yPos);
}
function mouseClicked() {
saveCanvas('save', 'png');
}