Skip to content

Commit

Permalink
change velocity up and down
Browse files Browse the repository at this point in the history
  • Loading branch information
lucastakejame committed Jan 29, 2018
1 parent 0a0af62 commit 02bf9fc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ window.onload = function(){
}
}
break;
case 'ArrowUp':
{
var p = 1.1; // linear interpolation
for(var i = 0; i < numParticles; i++) {
particles[i].xOld = (1-p)*particles[i].x + p*particles[i].xOld;
particles[i].yOld = (1-p)*particles[i].y + p*particles[i].yOld;
}
}
break;
case 'ArrowDown':
{

var p = 0.9; // linear interpolation
for(var i = 0; i < numParticles; i++) {
particles[i].xOld = (1-p)*particles[i].x + p*particles[i].xOld;
particles[i].yOld = (1-p)*particles[i].y + p*particles[i].yOld;
}
}
break;

}
} );

Expand Down

0 comments on commit 02bf9fc

Please sign in to comment.