p5.jsで回転とラジアンを使用して銀河スケッチを作成しましたが、draw()が実行されるときにbackground()が読み込まれるたびに消去されます。 background()関数をオーバーライドする方法はありますか?私は銀河系を見守って欲しい。p5.jsのbackground()関数をオーバーライドしていますか?
var stars;
function preload(){
//for (var i = 0; i < planetArray.length; i++) {
//stars = loadImage('Assets/stars.png');
}
function setup(){
createCanvas(windowWidth, windowHeight);
}
function draw() {
//background(0);
star()
//function mousepressed(){
}
function star(){
//angle = map(mouseX, 0,width, 0,360);
//rotate(radians(angle*100));
noStroke();
//translate(width/2, height/2);
translate(mouseX,mouseY);
fill(0);
rotate(radians(frameCount%360)); //rotates output of ellipses
rotate(radians(1000*frameCount%360));
for(var i =0; i < 20; i++){
push();
noStroke();
fill(random(200),0,random(150),random(2));
// fill(random(125),random(250),random(100));
ellipse(10*frameCount % (width/10),0,10,10);
//image(stars, 10*frameCount % (width/2),0,10,10)
//image((10*frameCount % (width/2),0,10,10)
//
pop();
}
}
ありがとうございました!私はセットアップ()に入れ、すべてが素晴らしいようです。私はあなたにカップケーキをfedExできることを願っています。 – Claire
ハ!ありがとう。私はカップケーキがメールを通してとてもうまく旅行するのかどうか分からない! –