|
@@ -330,7 +330,7 @@
|
|
|
}
|
|
|
|
|
|
if(this.center)
|
|
|
- this.slowDownNearCenter();
|
|
|
+ this.limitEvolutionZone();
|
|
|
|
|
|
if(!this.p.resting()){
|
|
|
// this.checkVelocityThreshold();
|
|
@@ -432,7 +432,7 @@
|
|
|
this.attract.on = false;
|
|
|
}
|
|
|
|
|
|
- Node.prototype.slowDownNearCenter = function(){
|
|
|
+ Node.prototype.limitEvolutionZone = function(){
|
|
|
// smouthly slow down node near center
|
|
|
// if(this.id == 1)
|
|
|
// console.log('this.p.velocity', this.p.velocity);
|
|
@@ -441,13 +441,12 @@
|
|
|
if( this.p.velocity.length() > 0.4 ){
|
|
|
this.p.velocity.multiplyScalar(0.995);
|
|
|
}
|
|
|
- // if(Math.abs(this.p.velocity.x) > 1){
|
|
|
- // this.p.velocity.x *= 0.99;
|
|
|
- // }
|
|
|
- // if(Math.abs(this.p.velocity.y) > 1){
|
|
|
- // this.p.velocity.y *= 0.99;
|
|
|
- // }
|
|
|
-
|
|
|
+ }
|
|
|
+ if( Math.abs(_attracter.position.x - this.x) > _canvas.width/3
|
|
|
+ || Math.abs(_attracter.position.y - this.y) > _canvas.height/3){
|
|
|
+ this.attract.on = true;
|
|
|
+ }else{
|
|
|
+ this.attract.on = false;
|
|
|
}
|
|
|
}
|
|
|
|