xxxxxxxxxx
let angle = 0;
let squareAngle = 0;
let planetAngle = 0;
let bigAngle = 0;
let earthAngle = 0;
let nothingAngle = 0;
let moonAngle = 0;
let marsAngle = 0;
let venus;
let sun;
let mars;
let earth;
let saturn;
function preload() {
sun = createSprite(windowWidth/2, windowHeight/2, 100);
let sunAnimation = sun.addAnimation('sun','Sun-1png.png','Sun-2png.png','Sun-3png.png');
sunAnimation.frameDelay = 10
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
angleMode(DEGREES);
venus = createSprite(10,10,10,10);
let venusAnimation = venus.addAnimation('venus','Venus-1png.png');
earth = createSprite(50,50,50,50);
let earthAnimation = earth.addAnimation('earth','earth-1png.png');
mars = createSprite(45,45,45,45);
let marsAnimation = mars.addAnimation('mars','Mars-1png.png');
saturn = createSprite(30,30,30,30);
let saturnAnimation = saturn.addAnimation('saturn','Saturn-1png.png');
}
function draw() {
background(0);
//Drawing and rotating a square
translate(windowWidth / 2,windowHeight / 2);
rectMode(CENTER);
rotate(squareAngle);
// Sun at origin
sun.position.x = 0;
sun.position.y = 0;
drawSprite(sun);
//Draw venus
rotate(planetAngle);
venus.position.x = 200;
planetAngle = planetAngle + 1.2;
drawSprite(venus);
//Draw earth
rotate(bigAngle);
earth.position.x = 350;
bigAngle = bigAngle +3;
drawSprite(earth);
//Draw mars
rotate(earthAngle);
mars.position.x = 500;
earthAngle = earthAngle - 2.5;
drawSprite(mars);
//neptune
rotate(nothingAngle);
saturn.position.x = 650;
nothingAngle = nothingAngle -1.2;
drawSprite(saturn);
}