Jon
Thanks for finding and reporting this. It turns out to be a bug in the
parseTwip function in swfc.c
where it reads
if(l==1)
return sign*atoi(str)*20+atoi(dot)*2;
if(l==2)
return sign*atoi(str)*20+atoi(dot)/5;
that should be
if(l==1)
return sign*(atoi(str)*20+atoi(dot)*2);
if(l==2)
return sign*(atoi(str)*20+atoi(dot)/5);
note the parentheses.
I guess Mattias will include this in the next snapshot. I'm sorry I don't have
a Windows build for you, Jon.
Regards,
Huub
Date: Mon, 7 Apr 2008 17:00:21 -0700
From: [EMAIL PROTECTED]
Subject: RE: [Swftools-common] Bug in 0.8.1 with negative x/y changes < 1
To: [email protected]
Huub,
Sorry, I got mixed up about the frame numbers. I meant it went to the right
between 50 and 100. You can see what my swftools installation outputs at:
www.peachcobbler.uni.cc/changenegativebug.swf
I haven't been able to test it on 0.9 since I'm using windows and can't get it
to compile.
Huub Schaeks <[EMAIL PROTECTED]> wrote: Jon
Looking at your example .sc file the box should move to the left between frame
1 and frame 50 then just a little bit more to the left until frame 100 then
just a little back to the right until frame 150 and to the right again back to
it's starting position. If I read your description correctly that is exactly
what it does.
The code you would like to patch
actually works correctly. If I insert your numbers I find:
p.x = (2 - 1) * 0.5 + 1 = 1.5
p.x = (-1.5 - (-1)) * 0.5 + (-1) = -1.25
There are some situations where the interpolation will fail in version 0.8.1
(resulting in some jittering).
Please use a more recent build than version 0.8.1 if possible. The
interpolation code for changing properties of objects in swfc has been
completely replaced.
Thanks for your time and effort.
Regards,
Huub
Date: Sun, 6 Apr 2008 19:21:09 -0700
From: [EMAIL PROTECTED]
To: [email protected]
Subject: [Swftools-common] Bug in 0.8.1 with negative x/y changes < 1
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.
Lees jij al je Hotmail op je mobiel? Probeer het nu!
You rock. That's why Blockbuster's offering you one month of Blockbuster
Total Access, No Cost.
_________________________________________________________________
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl