# HG changeset patch # User wycc # Date 1290527678 -28800 # Node ID 4072a302b207334d07b5a649ade0dbea921a77db # Parent 18329b6f77a416199dd337af71117b682d856a8f Fine tune the animation effect diff -r 18329b6f77a4 -r 4072a302b207 nodejs/animate.js --- a/nodejs/animate.js Tue Nov 23 08:04:09 2010 +0800 +++ b/nodejs/animate.js Tue Nov 23 23:54:38 2010 +0800 @@ -84,11 +84,14 @@ function scale_draw(percent) { - if (this.end==1) return; + if (this.end==1) { + percent = 1; + } var sx = 1 + (this.totalsx - 1) * percent; var sy = 1 + (this.totalsy - 1) * percent; var sh1 = [1, 0, -this.center_x, 0, 1, -this.center_y]; var sh2 = [1, 0, this.center_x, 0, 1, this.center_y]; + sys.puts("sc="+sx+" sy="+sy); var scale = [sx, 0, 0, 0, sy, 0]; var obj = this.obj; var mtx; diff -r 18329b6f77a4 -r 4072a302b207 nodejs/examples/mce/main.svg --- a/nodejs/examples/mce/main.svg Tue Nov 23 08:04:09 2010 +0800 +++ b/nodejs/examples/mce/main.svg Tue Nov 23 23:54:38 2010 +0800 @@ -2,6 +2,7 @@ + sodipodi:docname="main.svg"> diff -r 18329b6f77a4 -r 4072a302b207 nodejs/examples/mce/mainmenu.js --- a/nodejs/examples/mce/mainmenu.js Tue Nov 23 08:04:09 2010 +0800 +++ b/nodejs/examples/mce/mainmenu.js Tue Nov 23 23:54:38 2010 +0800 @@ -64,9 +64,9 @@ old.bbox.update(); target.bbox.update(); - var an = new animate.scale(this.app, old, 1, 1); + var an = new animate.scale(this.app, old, 1/1.1, 1/1.5); animate.run([an], 0, 0.1); - an = new animate.scale(this.app, target, 1, 1.5); + an = new animate.scale(this.app, target, 1.1, 1.5); animate.run([an], 0, 0.3); var sx = target.center.x - this.lightbar.center.x; var an = new animate.shift(this.app, this.lightbar, sx, 0); @@ -87,9 +87,9 @@ old.bbox.update(); target.bbox.update(); - var an = new animate.scale(this.app, old, 1, 1); + var an = new animate.scale(this.app, old, 1/1.1, 1/1.5); animate.run([an], 0, 0.1); - an = new animate.scale(this.app, target, 1, 1.5); + an = new animate.scale(this.app, target, 1.1, 1.5); animate.run([an], 0, 0.3); var sx = target.center.x - this.lightbar.center.x; var an = new animate.shift(this.app, this.lightbar, sx, 0); @@ -132,21 +132,20 @@ var sy = 220 - target.center.y; var an = new animate.shift(this.app,target,sx,sy); var self = this; - animate.run([an],0,1,function() {self.changePage();}); + animate.run([an],0,2.5,function() {self.changePage();}); for(i=0;i 0.5) x = 900; - else x = -500; - if (y > 0.5) y = 900; - else y = -500; - sx = x - this.items[i].center.x; - sy = y - this.items[i].center.y; + if (i > this.item) { + sx = 1920*2 - this.items[i].center.x; + sy = 0; + } else { + sx = -this.items[i].center.x*2; + sy = 0; + } an = new animate.shift(this.app,this.items[i], sx, sy); animate.run([an], 0, 2); alpha = new animate.alpha(this.app,this.items[i], 0); - animate.run([an], 0, 1); + animate.run([an], 0, 2); } }