Mercurial > MadButterfly
diff nodejs/animate.js @ 776:77b561bb7929
Implement new algorithm to calculate the origin of the SVG elemnts so that we can implement object resize without changing the position of the object.
However, the image does not work here since it does not use the transformation of the group.
author | wycc |
---|---|
date | Mon, 30 Aug 2010 08:56:44 +0800 |
parents | d11b0900f03c |
children | 7ec13634c97d |
line wrap: on
line diff
--- a/nodejs/animate.js Sun Aug 29 23:58:43 2010 +0800 +++ b/nodejs/animate.js Mon Aug 30 08:56:44 2010 +0800 @@ -62,19 +62,13 @@ if (this.end == 1) return; var percent = (Date.now() - this.starttime)/this.duration; if (percent > 1) percent = 1; - //sys.puts("time="+(Date.now()-this.starttime)+" percent="+percent); var sx = (this.targetx-this.startsx)*percent+this.startsx; var sy = (this.targety-this.startsy)*percent+this.startsy; var t=[sx,0,0,0,sy,0]; - //sys.puts("center="+this.obj.center.x+","+this.obj.center.y); this.obj[0] = sx; this.obj[4] = sy; this.obj[2] = this.origin_offset_x - (sx-this.startsx)*this.obj.center.x; this.obj[5] = this.origin_offset_y - (sy-this.startsy)*this.obj.center.y; - //sys.puts("sx="+sx); - //sys.puts("sy="+sy); - //sys.puts("offseet x="+this.obj[2]); - //sys.puts("offseet y="+this.obj[5]); this.app.refresh(); var self = this;