A Weather Animation

by NUSRATRAHMAN in Circuits > Software

415 Views, 0 Favorites, 0 Comments

A Weather Animation

2016-06-23.png

it the main season of our country.

Weather

2016-06-23.png

Hi, everyone . this is my first instructables. In this project , I am
going to show how to do any animation related with weather. This is quite different from any other animation. As we will do the animation by the help of Processing , so we don't need any hardware. But we will have to be quite careful about coding . Because if there is any mistake in coding, then we won't be able to see the animation . I have also added sound in my animation , so we will have to download the song/ sound from youtube. At first we will have to copy the link of this song(

on youtube mp3. to convert the video into mp3. So we will copy the link of that song on youtube mp3 and we will press " Convert video" button. After that we will press "Download" button. "Download" will be written in blue colour. Our computer /laptop will ask us as what name we can save the video . We will save the video by easy and shortcut name. You can download the processing software from the following link:

(https://processing.org/download/)

import processing.sound.*;//the code starts from here
SoundFile file;

Rain r1;

int numDrops = 40; Rain[] drops = new Rain[numDrops]; // Declare and create the array void setup () { size(500,500); background(255); file = new SoundFile(this, "Enigma - Rain song.mp3"); // we will write the name name of the song here exactly we saved in our laptop / computer file.play(); smooth(); //Loop through array to create each object for (int i = 0; i < drops.length; i++) {

drops[i] = new Rain(); // Create each object r1 = new Rain(); } }

int body=0;

void draw () { noStroke(); if (mouseX<250) { background(mouseX/0.98,mouseX/0.98,0); fill(255,255-mouseX/0.98,255-mouseX/0.98); ellipse(mouseX,150-mouseX/2.5,50,50); } else { background(255-(mouseX-250)/0.98,255-(mouseX-250)/0.98,0); fill(255,(mouseX-250)/0.98,(mouseX-250)/0.98); ellipse(mouseX,50.4+(mouseX-250)/2.5,50,50); } fill(255,80); // rect(0,0,600,600); //Loop through array to use objects. for (int i = 0; i < drops.length; i++) { drops[i].fall(); }

ellipseMode(CENTER); rectMode(CENTER);

//body fill(body,0,0); rect(mouseX , mouseY , 30 , 100);

//arms

line(mouseX-15, mouseY-20, pmouseX-50, pmouseY-20); line(mouseX+15, mouseY-20, pmouseX+50, pmouseY-20); //legs line(mouseX-15, mouseY+50 ,mouseX-15, pmouseY+80); line(mouseX+15, mouseY+50 , pmouseX+15, pmouseY+80);

//head fill(255); ellipse(mouseX , mouseY-70 , 60,60);

//eyes fill(mouseX/2 , 0 , mouseY/2); ellipse(mouseX+20 , mouseY-70 , 10,20); ellipse(mouseX-20 , mouseY-70 , 10 ,20);

//mouth fill(mouseX/2 , 0 , mouseY/2); stroke(0,0,0); arc(mouseX-2 , mouseY-55 , 30, 20 , 0 , PI);

}

void mousePressed ()

{ body = 255; println("Mouse Has Been Pressed"); }

class Rain { float r = random(600); float y = random(-height);

void fall() { y = y + 7; fill(0,10,200,180); ellipse(r, y, 10, 10);

if(y>height){ r = random(600); y = random(-200); } } }//finishes here