Hello everyone,

I took some time today to test many of the examples under Mozilla
1.0.1/Linux.  One example that I noticed didn't work at all and seemed
like it might be easy to fix was the dynapi.fx.pathanim-glide.html. 
(This email is taking forever to write because i keep finding answers to
my problems as I'm explaining them)  Now I am stuck with Mozilla
complaining that there is no setID function when it is in the
constructor of the DynObject.

Oh, and I moved the dynapi.function.getNormalizedAngle over to
ext/functions.math.js too, which, to me, seems logical.

--
Dan Willemsen


Here are the diffs of what I have chnaged so far: (If you want me just
to attach the full files, I'll do that too)

Index: fx/pathanim_glide.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/fx/pathanim_glide.js,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pathanim_glide.js
--- fx/pathanim_glide.js        10 Feb 2003 22:35:58 -0000      1.1.1.1
+++ fx/pathanim_glide.js        12 Feb 2003 01:48:08 -0000
@@ -7,17 +7,21 @@
        requires: dynapi.fx.Thread
 */

-DynLayer.prototype.glideTo =
function(x,y,angleinc,ms,startSpeed,endSpeed) {
+PathAnimation.glideTo = function(x,y,angleinc,ms,startSpeed,endSpeed) {
        if (this.x!=x && this.y!=y) {
-               if (!this._thread) this._thread = new Thread(this);
+               if (!this._thread){
+                       this._thread = new Thread;
+                       this._thread = Thread(this);
+               }
                if (ms) this._thread.interval = ms;
-               this._thread.play(
GlideAnimation(this.x,this.y,x2,y2,angleinc,startSpeed,endSpeed) );
+               this._thread.play(
GlideAnimation(this.x,this.y,null,null,angleinc,startSpeed,endSpeed) );
+       }
 };
-DynLayer.prototype.glideStop = function () {
+PathAnimation.glideStop = function () {
        if (this._thread) this._thread.stop();
 };

-function Glide(x1,y1,x2,y2,angleinc,startSpeed,endSpeed) {
+function GlideAnimation(x1,y1,x2,y2,angleinc,startSpeed,endSpeed) {
        if (x2==null) x2 = x1;
        if (y2==null) y2 = y1;

@@ -77,21 +81,4 @@
                path[l+1] = y2;
        }
        return path;
-};
-
-// Returns correct angle in radians between 2 points
-dynapi.functions.getNormalizedAngle = function (x1,y1,x2,y2) {
-       var distx = Math.abs(x1-x2);
-       var disty = Math.abs(y1-y2);
-       if (distx==0 && disty==0) angle = 0;
-       else if (distx==0) angle = Math.PI/2;
-       else angle = Math.atan(disty/distx);
-       if (x1<x2) {
-               if (y1<y2) angle = Math.PI*2-angle;
-       }
-       else {
-               if (y1<y2) angle = Math.PI+angle;
-               else angle = Math.PI-angle;
-       }
-       return angle;
 };

Index: ext/functions.math.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/ext/functions.math.js,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 functions.math.js
--- ext/functions.math.js       10 Feb 2003 22:35:56 -0000      1.1.1.1
+++ ext/functions.math.js       12 Feb 2003 01:48:08 -0000
@@ -22,6 +22,23 @@
        for (var i=0; i<361; i+=1) lcos[i]=Math.cos((i/180)*Math.PI);
 };

+// Returns correct angle in radians between 2 points
+f.getNormalizedAngle = function (x1,y1,x2,y2) {
+       var distx = Math.abs(x1-x2);
+       var disty = Math.abs(y1-y2);
+       if (distx==0 && disty==0) angle = 0;
+       else if (distx==0) angle = Math.PI/2;
+       else angle = Math.atan(disty/distx);
+       if (x1<x2) {
+               if (y1<y2) angle = Math.PI*2-angle;
+       }
+       else {
+               if (y1<y2) angle = Math.PI+angle;
+               else angle = Math.PI-angle;
+       }
+       return angle;
+};
+
 // Path Functions ------------------------

 // Combines separate [x1,x2],[y1,y2] arrays into a path array
[x1,y1,x2,y2]

Index: examples/dynapi.fx.pathanim-glide.html
===================================================================
RCS file:
/cvsroot/dynapi/dynapi3x/examples/dynapi.fx.pathanim-glide.html,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 dynapi.fx.pathanim-glide.html
--- examples/dynapi.fx.pathanim-glide.html      10 Feb 2003 22:35:42
-0000      1.1.1.1
+++ examples/dynapi.fx.pathanim-glide.html      12 Feb 2003 01:49:44
-0000
@@ -4,7 +4,8 @@
 <script language="JavaScript" src="../src/dynapi.js"></script>
 <script language="Javascript">
 dynapi.library.setPath('../src/');
-dynapi.library.include('dynapi.api');
+dynapi.library.include('dynapi.api');
+dynapi.library.include('Math');
 dynapi.library.include('PathAnimation');
 dynapi.library.include('GlideAnimation');
 </script>
@@ -21,10 +22,10 @@

        squarePath = new PathAnimation(block);
        squarePath.sleep(20);
-       var p = PathAnimation.glide(200,100,400,100,7,'slow','slow');
-       p = p.concat(
PathAnimation.glide(400,100,400,200,7,'slow','slow') );
-       p = p.concat(
PathAnimation.glide(400,200,200,200,7,'slow','slow') );
-       p = p.concat(
PathAnimation.glide(200,200,200,100,7,'slow','slow') );
+       var p = PathAnimation.glideTo(200,100,400,100,7,'slow','slow');
+       p = p.concat(
PathAnimation.glideTo(400,100,400,200,7,'slow','slow') );
+       p = p.concat(
PathAnimation.glideTo(400,200,200,200,7,'slow','slow') );
+       p = p.concat(
PathAnimation.glideTo(200,200,200,100,7,'slow','slow') );
        squarePath.add(p,true);

        var listener = {}
@@ -51,9 +52,9 @@

 <body bgcolor="#999999">

-<p>Square Slide:
+<!--<p>Square Slide:
 <br><a href="javascript://" onclick="squarePath.play(); return
false;">start</a>
-<br><a href="javascript://" onclick="squarePath.stop(); return
false;">pause</a>
+<br><a href="javascript://" onclick="squarePath.stop(); return
false;">pause</a>-->

 <p>SlideTo:
 <br>(<a href="javascript://" onclick="block.glideTo(200,100); return
false;">200,100</a>) slow,slow



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/

Reply via email to