xxxxxxxxxx
var rain = [] // array for rain drops
let page_number = 1
var text1 = "10:25"
let cloud // image
let k = 0 // iterator
function preload(){
cloud = loadImage ('cloud.jpg');
}
function setup() {
createCanvas(400, 500);
}
function draw() {
image(cloud,0,0)
var l = random(0,100)
while(k<200){ // display text time
k= k+ 2;
textSize(50)
text(text1,130,140)
}
k= 0 // rest your iterator
if(l<1)
{
rain.push(new weather()) // push into array
}
for(var i = 0; i < rain.length; i ++) // for the length of the array do this
{
rain[i].display()
if(rain[i].x > width)
{
rain.splice(i,5) // insert index 5
}
}
}
function weather(){
this.x = random(0,width) // random rain on the horizontal line
this.y = 0
this.speed = random(4,10) // random speed from 4,10
this.display = function()
{
this.y = this.y + this.speed
stroke('black')
fill('black')
circle(this.x, this.y, 65)
}
}