diff nodejs/animate.js @ 808:9b6c26cf9102

Move bounding box and center back to an object
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 01 Sep 2010 20:04:35 +0800
parents bf54c0408d35
children 586e50f82c1f
line wrap: on
line diff
--- a/nodejs/animate.js	Wed Sep 01 18:04:20 2010 +0800
+++ b/nodejs/animate.js	Wed Sep 01 20:04:35 2010 +0800
@@ -87,9 +87,9 @@
     cv = Math.cos(ang);
     mtx = [cv, -sv, 0, sv, cv, 0];
 
-    shift = [1, 0, -obj.center_x, 0, 1, -obj.center_y];
+    shift = [1, 0, -obj.center.x, 0, 1, -obj.center.y];
     mtx = multiply(mtx, shift);
-    shift = [1, 0, obj.center_x, 0, 1, obj.center_y];
+    shift = [1, 0, obj.center.x, 0, 1, obj.center.y];
     mtx = multiply(shift, mtx);
     mtx = multiply(mtx, this._start_mtx);
 
@@ -183,14 +183,18 @@
 }
 
 holder.prototype = {
-    go_center: function(o) {
+    go: function(pos) {
 	var sx, sy;
 
-	sx = o.center_x - this._coord.center_x;
-	sy = o.center_y - this._coord.center_y;
+	sx = pos.x - this._coord.center.x;
+	sy = pos.y - this._coord.center.y;
 	this.shift(sx, sy);
     },
 
+    go_center: function(o) {
+	this.go(o.center);
+    },
+    
     home: function() {
 	this._coord[2] = this._mtx[2];
 	this._coord[5] = this._mtx[5];