每当我fill()在 p5.js 中使用时,我所有的用户定义函数都会受到它的影响。为什么?
这是我的代码:
let a1 = a2 = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(200);
fill(100,100,10);
translate(width/2,height/2);
angleMode(DEGREES);
rotate(a1);
ellipse(20,20,50,50);
a1+=1;
(20,20);
}
function rotateAbout(x,y){
translate(x,y);
angleMode(DEGREES);
rotate(a2);
ellipse(15,15,20,20);
a2+=1;
}
Run Code Online (Sandbox Code Playgroud)