swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] Bug in 0.8.1 with negative x/y changes < 1


From: Jon Hartford
Subject: [Swftools-common] Bug in 0.8.1 with negative x/y changes < 1
Date: Sun, 6 Apr 2008 19:21:09 -0700 (PDT)

First, thanks to Matthias and the rest of the coders for making swftools. It's the most useful open-source software I've found for making flash files.

--bug:--

I've found that when you specify e.g.: ".change (object) x=-1.5" that it's actually animated to where -0.5 would be on the x axis.

Example code:

.flash name="changenegativebug.swf" fps=50
.box b1 10 10 fill=white color=white
.put b1 x=0
.frame 50
.change b1 x=-3
.frame 100
.change b1 x=-3.5
.frame 150
.change b1 x=-3
.frame 200
.change b1 x=0
.end

Instead of moving the box just a little to the left between frames 100 and 150, it moves it to the right.

--problem:--

I do some programming (mostly web programming -- PHP, CSS, HTML...) but I looked through the source code for 0.8.1 and I'm guessing that this is the problem is in swfc.c in the "parameters_t s_interpolate" function. (Lines 1856 & 1857) The current code is:

    p.x = (p2->x-p1->x)*ratio + p1->x;
    p.y = (p2->y-p1->y)*ratio + p1->y;

so:
if p2->x = 2 and p1->x = 1 and ratio=0.5 then p.x = 1.5
if p2->x = -1.5 and p1-> = -1 and ratio=0.5 then p.x = -0.75 (!)

--patch:--

I don't do any C programming, and this is probably not the most elegant solution, but it demonstrates (I think) how to fix it:

if ((p2->x-p1->x)*ratio<0) {
  p.x = (p2->x-p1->x)*ratio*-1 + p1->x;
} else {
  p.x = (p2->x-p1->x)*ratio + p1->x;
}
if ((p2->y-p1->y)*ratio<0) {
  p.y = (p2->y-p1->y)*ratio*-1 + p1->y;
} else {
  p.y = (p2->y-p1->y)*ratio + p1->y;
}


Hopefully this very verbose (maybe too verbose) bug report helps.


Thanks again for the awesome swf tools.
Jon


You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]