Skip to content

Commit 96bbbc2

Browse files
author
Andrew Mahon (Type/Code)
committed
tweaking physics
1 parent 4b07709 commit 96bbbc2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/tc.app.particle.context.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ if(!tc){ var tc = {}; }
8585
//tc.util.log('tc.particle.context[_me.update]');
8686
_me.frame++;
8787
_me.net_energy = 0;
88+
for(i = 0; i < _me.forces.length; i++){
89+
_me.forces[i].radius = (_me.forces[i].radius * 0.98);
90+
}
8891
if(!_me.stopped){
8992
for(i = 0; i < _me.particles.length; i++){
9093
_me.particles[i]['reset_forces']();
@@ -131,8 +134,7 @@ if(!tc){ var tc = {}; }
131134

132135
function _draw(){
133136
//tc.util.log('tc.particle.context[_me.draw]');
134-
//_me.context.clearRect(0,0,_me.bounds.max_x,_me.bounds.max_y);
135-
var opacity;
137+
var opacity, i;
136138

137139
_me.context.globalAlpha = 1;
138140
_me.context.fillStyle = 'rgba(252,252,252,0.5)';
@@ -154,7 +156,8 @@ if(!tc){ var tc = {}; }
154156
}
155157

156158
_me.context.globalAlpha = 1 - opacity + 0.01;
157-
for(var i = 0; i < _me.particles.length; i++){
159+
160+
for(i = 0; i < _me.particles.length; i++){
158161
_me.particles[i].draw(_me.context);
159162
}
160163
}

0 commit comments

Comments
 (0)