PImage balloon;

void setup() {
  size(800, 500);
  balloon = loadImage("balloon.png");
}

void draw() {
  drawSky();
  image(balloon, mouseX, mouseY);
}



color darkBlue = color(86, 116, 200);
color lightBlue = color(177, 191, 210);

/**
 * Draws a sky with a gradient from dark to light blue.
 */
void drawSky() {
  for (int y = 0; y < height; y++) {
    color currentBlue = getGradientColor(darkBlue, lightBlue, height, y);
    stroke(currentBlue);
    line(0, y, width, y);
  }
}

/**
 * Gets current color of a gradient.
 * (Analogous to the gray gradient function but with three values.)
 *
 * start    - Color to begin gradient with.
 * end      - Color to fade to.
 * steps    - Number of gradient steps.
 * current  - Current step of the gradient.
 */
color getGradientColor(color start, color end, float steps, float current) {
  float r = red(start) + ((red(end) - red(start)) / steps * current);
  float g = green(start) + ((green(end) - green(start)) / steps * current);
  float b = blue(start) + ((blue(end) - blue(start)) / steps * current);
  
  return color(r,g,b);
}
