Grade 7 Science: Coding Project 2 – Shooting Star

This exercise is a project from Khan Academy’s Intro to JS: Drawing & Animation.  

The objective of this exercise is to write a program below to make a star shoot across the screen.  The animated video could not be uploaded to the blog.

var xPos = 10;
var yPos = 10;
var xPos2 = 20;
var yPos2 = 20;

draw = function() {
background(20, 19, 19);
fill(255, 242, 0);
ellipse(xPos, yPos, 30, 30);

xPos+= +10;
yPos-= -10;

fill(255, 242, 0);
ellipse(xPos2, yPos2, 30, 30);

xPos2+= +20;
yPos2+= +20;

};

Unknown's avatar

Author: sophiaelahirpc

10th Grade student in the Ron Paul Curriculum. Full-time teen writer living in Singapore.

Leave a comment

Design a site like this with WordPress.com
Get started