[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 /* 2 DynAPI Distribution 3 HoverAnimation Class 4 5 The DynAPI Distribution is distributed under the terms of the GNU LGPL license. 6 7 requires: dynapi.functions.Math, dynapi.fx.Thread 8 */ 9 10 function HoverAnimation(dlyr) { 11 this.Thread = Thread; 12 this.Thread(dlyr); 13 14 this.offsetX = 0; 15 this.offsetY = 0; 16 this.playing = false; 17 this.amplitude = 100; 18 this.angle = 0; 19 this.setAngleIncrement(10); 20 }; 21 var p = dynapi.setPrototype('HoverAnimation','Thread'); 22 p.setAmplitude = function (amp) { 23 this.amplitude = amp; 24 }; 25 p.setAngle = function (a) { 26 this.angle = dynapi.functions.degreeToRadian(a); 27 }; 28 p.setAngleIncrement = function (inc) { 29 this.angleinc = dynapi.functions.degreeToRadian(inc); 30 }; 31 p.playAnimation = function () { 32 this.playing = true; 33 if (this.dlyr!=null) { 34 this.offsetX = 0; 35 this.offsetY = this.amplitude*Math.sin(this.angle); 36 this.baseX = this.dlyr.x; 37 this.baseY = this.dlyr.y+this.offsetY; 38 this.dlyr.invokeEvent("hoverstart"); 39 } 40 this.start(); 41 }; 42 p.stopAnimation = function () { 43 this.playing = false; 44 this.stop(); 45 if (this.dlyr!=null) this.dlyr.invokeEvent("hoverstop"); 46 }; 47 p.run = function () { 48 if (!this.playing || this.dlyr==null) return; 49 this.angle += this.angleinc; 50 this.offsetX = 0; 51 this.offsetY = this.amplitude*Math.sin(this.angle); 52 if (this.dlyr!=null) { 53 this.dlyr.invokeEvent("hoverrun"); 54 this.dlyr.setLocation(this.baseX+this.offsetX,this.baseY+this.offsetY); 55 } 56 }; 57 p.reset = function () { 58 this.angle = this.offsetX = this.offsetY = 0; 59 }; 60 61 p.generatePath = function(centerX,centerY) { 62 // to do 63 };
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |