Why does my background color keep covering my animation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does my background color keep covering my animation?

I'm currently doing Khan Academy's Computer Programming class. One of the projects I'm doing is the shooting star animation. I created a backdrop of skyscrapers with a background. Then, I tried doing to animation, but the background keeps covering the whole illustration when I move the "background ()" into the draw () {} function and it's really frustrating. If anyone is familiar with Khan Academy's way of programming let me know. Also, I have pictures of my code and if anyone needs to see them I'll upload them on a drive or something if it makes more sense to see a visual. Overall, I'm just confused and frustrated.. lol

11th May 2020, 1:20 AM
Rebekah D Luke
Rebekah D Luke - avatar
5 Answers
+ 3
Post ur code here then we will make soln
11th May 2020, 1:29 AM
Abhay
Abhay - avatar
+ 2
Mirielle i dont know what im doing tbh... maybe i should restart my whole project?
11th May 2020, 3:09 PM
Rebekah D Luke
Rebekah D Luke - avatar
0
It's a lot... might not make sense but here. These are pictures of the code animation I'm doing. One of them is with the draw function and one is not.. https://ibb.co/DMrPtYs https://ibb.co/LtGdxX9 var xPos = 200; var yPos = 200; draw = function() { background(36,30,38); fill(255, 242, 0); ellipse(xPos, yPos, 10, 10); }; background(35,20,50); noStroke(); fill(36, 30, 38); //skyscrapers in background rect(50,200,140,1000); rect(100,150,14,150); rect(150,130,40,150); rect(155,115,14,750); rect(173,100,14,50); rect(200,150,14,50); rect(220,240,50,20); rect(270,240,70,80); rect(265,220,50,80); rect(276,211,30,19); rect(286,200,10,19); noStroke(); fill(43, 10, 43); //skyscrapers rect(0,250,70,150); rect(0,250,100,200); rect(100,350,50,50); rect(150,390,100,90); rect(150,299,80,250); rect(150,190,80,110); rect(200,260,70,50); rect(200,270,70,50); rect(200,350,70,50); rect(200,300,70,50); rect(250,300,70,70); rect(260,350,60,70); rect(320,160,70,250); rect(350,350,80,150); //windows on first building fill(242, 165, 41); //windows row 1 rect(4,255,10,20); rect(24,255,10,20); rect(42,255,10,20); rect(60,255,10,20); rect(79,255,10,20); //windows row 2 rect(4,280,10,20); rect(24,280,10,20); rect(42,280,10,20); rect(60,280,10,20); rect(79,280,10,20); //windows row 3 rect(4,304,10,20); rect(24,304,10,20); rect(42,304,10,20); rect(60,304,10,20); rect(79,304,10,20); //windows row 4 rect(4,329,10,20); rect(24,329,10,20); rect(42,329,10,20); rect(60,329,10,20); rect(79,329,10,20); //windows row 5 rect(4,354,10,20); rect(24,354,10,20); rect(42,354,10,20); rect(60,354,10,20); rect(79,354,10,20); //windows row 6 rect(4, 379,10,20); rect(24,379,10,20); rect(42,379,10,20); rect(60,379,10,20); rect(79,379,10,20); //doors on second building rect(169,359,20,37); rect(195,359,20,37); //windows on second building //windows row 1 rect(155,199,15,15); rect(180,199,15,15); rect(205,199,15,15); //windows row 2 rect(155,225,15,
11th May 2020, 1:36 AM
Rebekah D Luke
Rebekah D Luke - avatar
0
Mirielle i did it i think... but nothing is showing up in the output, now im even more confused lol https://code.sololearn.com/Wlk5YDB64AIa/?ref=app
11th May 2020, 2:21 PM
Rebekah D Luke
Rebekah D Luke - avatar
0
Mirielle okay ill try again then reshare it
11th May 2020, 2:56 PM
Rebekah D Luke
Rebekah D Luke - avatar