Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float[] strX = new float[100]; //stars
- float[] strY = new float [100];
- float[] speed = new float[100];
- void setup() {
- size(500,400);
- background(0);
- stroke(255);
- strokeWeight(3);
- int i = 0;
- while(i < 100) {
- strX[i] = random(0, width);
- strY[i] = random(0, height);
- speed[i] = random(0, 5);
- i = i + 1;
- }
- }
- void draw() {
- background (0);
- int i = 0;
- while(i < 100){
- point(strX[i], strY[i]);
- strX[i] = strX[i] - speed[i];
- if(strX[i] < 0) {
- strX[i] = width;
- }
- i = i + 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement