소스 검색

correct offset for particles

Kevin Heinicke 10 년 전
부모
커밋
d284c5eb36
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      js/views/particle.js

+ 6 - 3
js/views/particle.js

@@ -13,8 +13,8 @@
     ParticleView.prototype = new createjs.Shape();
 
     ParticleView.prototype.update = function(){
-        this.x = cell_size * this.model.position.x;
-        this.y = cell_size * this.model.position.y;
+        this.x = cell_size * this.model.position.x + cell_size / 2;
+        this.y = cell_size * this.model.position.y + cell_size / 2;
     }
 
     ParticleView.prototype.animate = function(){
@@ -23,7 +23,10 @@
             this.update();
             this.update = function(){};
             createjs.Tween.get(this).to(
-                { x: cell_size * this.model.target.x, y: cell_size * this.model.target.y },
+                {
+                    x: cell_size * this.model.target.x + cell_size / 2,
+                    y: cell_size * this.model.target.y + cell_size / 2 
+                },
                 // We do not want to have magnetically curved particles for now
                 // {guide:{ path:[0,0, 0,200,200,200, 200,0,0,0] }},
                 this.model.target.time - this.model.start_time