comparison nodejs/animate.js @ 788:7ec13634c97d

Add holder for animate
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 31 Aug 2010 02:36:01 +0800
parents 77b561bb7929
children a27606be2cab
comparison
equal deleted inserted replaced
787:0899dcac441c 788:7ec13634c97d
110 110
111 111
112 exports.scale = scale; 112 exports.scale = scale;
113 scale.prototype.start = scale_draw; 113 scale.prototype.start = scale_draw;
114 scale.prototype.draw = scale_draw; 114 scale.prototype.draw = scale_draw;
115
116 function holder(app, coord) {
117 var mtx = [coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]];
118
119 this._mtx = mtx;
120 this._coord = coord;
121 this._app = app;
122 }
123
124 holder.prototype = {
125 go_center: function(o) {
126 var sx, sy;
127
128 sx = o.center_x - this._coord.center_x;
129 sy = o.center_y - this._coord.center_y;
130 this.shift(sx, sy);
131 },
132
133 home: function() {
134 this._coord[2] = this._mtx[2];
135 this._coord[5] = this._mtx[5];
136 this._app.refresh();
137 },
138
139 shift: function(sx, sy) {
140 this._coord[2] = this._mtx[2] + sx;
141 this._coord[5] = this._mtx[5] + sy;
142 this._app.refresh();
143 }
144 };
145
146 exports.holder = holder;