Crawling Ants...Should be Staggering Ants!
Ned Konz
ned at bike-nomad.com
Tue May 13 17:29:00 UTC 2003
On Tuesday 13 May 2003 07:54 am, Sean Charles wrote:
> I'm playing with PolygonMorph (what a tool!) with a view to using
> it as a flight-path specifier for an animation package I started
> over four year ago, must be bored again. The joys of
> unemployment...anyway, when I set a dashed line and stepping rate,
> the ants don't march, they stagger.
I think this is due to a rounding issue in the dashed line algorithm.
Does this happen with a perfectly horizontal or vertical line?
If you look at the same line without the dashes, you'll see "jaggies"
if it's not straight. When the dashes are animated, you see these
jaggies as side-to-side motion of the dashes. The way the line is
being drawn when it's animated and dashed, the starting offset is
being stepped. This is moving the jaggies each step.
I *think* that some careful mixing of float and integer math in
Canvas>>line: pt1 to: pt2 width: width color: color1 dashLength: s1
secondColor: color2 secondDashLength: s2 startingOffset:
startingOffset
would help. Of course, it might slow it down too.
> There is a visible meandering of the line of plus/minus a pixel or
> two.
What part meanders? Not the vertices, right?
A more serious problem with animated dashes is that it eats up LOTS of
CPU, especially if you have several animated lines. The lines get
invalidated and re-drawn constantly. Even worse is when you have
animated dashed *curved* lines!
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|