package guimodule;

import processing.core.PApplet;

public class MySun extends PApplet{

}

@@ -44,16 +44,47 @@
 PApplet;
+%0Aimport processing.core.PImage;
 %0A%0Apublic
@@ -112,12 +112,1264 @@
 PApplet%7B
+%0A%09private PImage img;%0A%0A%09public void setup() %7B%0A%09%09//Add setup code for MyPApplet%0A%09%09size(400,400);%09%09%09%09//set canvas size%0A%09%09background(255);%09%09%09//set canvas color%0A%09%09stroke(0);%09%09%09%09//set pen color%0A%09%09img = loadImage(%22palmTrees.jpg%22, %22jpg%22);%0A%09%09img.resize(0, height);%09%09%09//resize loaded image to full height of canvas%0A%09%09image(img, 0, 0);%09%09%09//display image %0A%09%7D%0A%09%0A%09public void draw() %7B%0A%09%09//Add drawing code for MyPApplet%0A%09%09int%5B%5D color = sunColorSec(second());%09%09//calculate color code for sun%0A%09%09fill(color%5B0%5D,color%5B1%5D,color%5B2%5D);%09//set sun color%0A%09%09ellipse(width/4,height/5,width/4,height/5);%09//draw sun%0A%09%7D%0A%09%0A%09/** Return the RGB color of the sun at this number of seconds in the minute */%0A%09public int%5B%5D sunColorSec(float seconds)%0A%09%7B%0A%09%09int%5B%5D rgb = new int%5B3%5D;%0A%09%09// Scale the brightness of the yellow based on the seconds.  0 seconds %0A%09%09// is black.  30 seconds is bright yellow.%0A%09%09float diffFrom30 = Math.abs(30-seconds);%0A%09%09%0A%09%09float ratio = diffFrom30/30;%0A%09%09rgb%5B0%5D = (int)(255*ratio);%0A%09%09rgb%5B1%5D = (int)(255*ratio);%0A%09%09rgb%5B2%5D = 0;%0A%09%09%0A%09%09//System.out.println(%22R%22 + rgb%5B0%5D + %22 G%22 + rgb%5B1%5D + %22 B%22 + rgb%5B2%5D);%0A%09%09return rgb;%0A%09%7D%09%0A%09%0A%09public static void main (String%5B%5D args) %7B%0A%09%09//Add main method for running as application%0A%09%09PApplet.main(new String%5B%5D %7B%22--present%22, %22MyPApplet%22%7D);%0A%09%7D
 %0A%0A%7D%0A

Add Sunny Code