Comutare navigație
pbInfo.ro
Probleme
Probleme - clasa a IX-a
Probleme - clasa a X-a
Probleme - clasa a XI-a
Probleme din concursuri
Căutare problemă
Exerciții
Programează cu Blockly
Desenează cu Processing
Exersează SQL
Soluţii
Resurse
Resurse pentru clasa a IX-a
Resurse pentru clasa a X-a
Resurse pentru clasa a XI-a
Subiecte bacalaureat
Ajutor
Autentificare
Înregistrare
×
Autentificare
Utilizator sau email
Parola
Acest site foloseşte cookies. Navigând în continuare, vă exprimaţi acordul asupra folosirii cookie-urilor.
Îti place pbInfo? Atunci acceptă-l cu totul! Dezactivează modulul de blocare a reclamelor!
×
Lista scripturi
Script Nou
Ajutor
"Just Rain2 ( Bug )" - Processing
ID
Autor
Duplicat din
Ultima modificare
#1662
Lazar Ionut Radu (LazarIonutRadu)
-
Marti, 06 feb 2018, 22:37
var drop; var drops = [400]; var particle = [400]; var theta ; var s; var x,y; function setup() { createCanvas(400, 400); theta = 0 //random(-QUARTER_PI,QUARTER_PI); drop = new RainDrops(); for( var i=0 ; i<400 ; i++) { drops[i] = new RainDrops(); } } function draw() { GradientalBackground(); theta = (mouseX - 200) * QUARTER_PI / 400; s = 15; for(var i=0 ; i<200 ; i++) { drops[i].update(); drops[i].display(); drops[i].Splash(); drops[i].refresh(); } } function GradientalBackground() { noStroke(); fill(58, 96, 115); rect(-1,0,402,11); for( var y=0 ; y<=400; y+=10 ) // low resolution { noStroke(); fill(58-y*36/400,96-y*62/400,115-y*73/400); rect(0,y,400,y+1); } //Culorile (58, 96, 115),(22, 34, 42); } function RainDrops() { this.splash=0; this.x=random(-100,500); this.y=random(0,-50); this.lenght=20; this.speed=15; this.speedX=this.speed*sin( theta ); this.speedY=this.speed*cos( theta ); this.lenghtX=this.lenght*sin( theta ); this.lenghtY=this.lenght*cos( theta ); this.weight=1; this.limit=random(200,380); this.display = function() { if(this.y<=this.limit) stroke(255); strokeWeight(this.weight); line(this.x,this.y,this.x+this.lenghtX,this.y+this.lenghtY); } this.update = function() { if(this.y
=this.limit && this.splash<7){ strokeWeight(1); stroke(255); line(this.x-this.splash+this.lenghtX,this.y+this.lenghtY,this.x+this.splash+this.lenghtX,this.y+this.lenghtY); this.splash+=1.2;} } this.refresh = function() { if(this.y>=this.limit && this.splash>7) { this.splash=0; this.x=random(-200,600); this.y=random(0,-500); this.lenght=16; this.speed=15 this.speedX=this.speed*sin( theta ); this.speedY=this.speed*cos( theta ); this.lenghtX=this.lenght*sin( theta ); this.lenghtY=this.lenght*cos( theta ); this.weight=random(0.8,1.2); this.limit=random(300,380); } } }
Duplicare
Executare
Cod
×
Cod HTML
<iframe sandbox="allow-scripts" src="/p5js/index.php?id=1662" style="width:408px; height:408px;border:solid 1px gray; overflow: scroll;"></iframe>
×
Duplicare script
Denumirea noului script
Du-te sus!