mardi 12 juillet 2022

New to Processing

I am new to processing and I am trying to create a code that has the sun go to a random spot and if it is under the horizon the sky is dark blue and above the horizon is light blue. The if line is where I am not sure how to write it. How can I write this so that the sun is in a different location.

''' float sunY = random(0, 600); int green = color(30, 200, 95);

    if sunY < 150; //below the horizon
    {
      skyColor = color(35, 1, 229); //dark blue
    }
    else //above the horizon
    {
      skyColor = color(163, 238, 252); //light blue
    }

    // Draw the sky
    background(skyColor);

    // Draw the ground
    noStroke();
    fill(green);
    rect(0, 400, 800, 200);

'''




Aucun commentaire:

Enregistrer un commentaire