Graphic speed comparison between webLets and desktop stacks
James Hurley
jhurley0305 at sbcglobal.net
Mon Sep 7 11:29:57 EDT 2009
I enjoyed Ben Beaumont's presentation of planetary motion at the
conference. I couldn't tell from the streaming video how smoothly the
planets moved around the Sun. It was very bumpy on my screen, but most
of that was surely due to the nature of streaming video. To see this
for myself, I built a stack (see below) to compare the moving planets
on the desktop with the webLet. We know that the speeds will change,
but by how much?
(By the way, I thought it was terrific. I was really impressed by how
bright and articulate the presenters were. Lots of really good
information.)
In order to get some quantitative data I made a stack to simulate a
ball (planet) moving along a set of points on a circle--see stack and
web site below.
In dealing with graphics (or images) moving along a set of points on a
line there are three ways to cycle through the points:
(1) Use a "Send message in x millisec" to cycle recursively through
the points using x to control speed. (Asynchronous--i.e. allows for
concurrent message sending)
(2) Use a simple repeat loop, using a "Wait x millisec" between repeat
to control speed (Not asynchronous)
(3) Or use the Rev Move command, using the DragSpeed propterty to
control speed. (Asynchronous)
And there are generally two methods of moving an object from one point
to the next:
(A) Using the set location command
(B) Using the Move command.
In all of these options, the number of points on the graphic line is a
potential variable and will affect the speed and the smoothness of the
motion. It is the smoothness of the motion that to me is the critical
factor, not too difficult to achieve on the desktop but much more
difficult on the Web. I failed on the Web task. I don't know if Rev is
still working on this. It is not a high priority issue at this time.
Here is what I found from playing with the parameters (1, 2, 3, A, B
above) using the "OnWebGraphicTImer" stack below:
(1) Speed: The web is much faster than the desktop, as much as five
and a half times faster if one uses "Set Loc" to cycle through the
points. If one uses the Move command to move through the points THERE
IS NO CHANGE in speed. I presume that Rev redefined Move to have this
effect.
(2) Smooth motion: On the desktop, Set Loc and Send Message In TIme is
the best way to go. The synchronous repeat loop is bumpy, as it the
Move command. On the Web I couldn't find any combination of parameters
and modes and number of points on the line to achieve smooth motion.
You can also see this bumpy motion on Rev's own Web site: http://revmedia.runrev.com/revMedia/
Notice how the Rev icon bumps along the set of line points.
There is another problem intrinsic to the Move command: The speed
along the points is uniform regardless of the distance between points.
The speed along the entire path is governed by the MoveSpeed property.
Because of this it cannot be used to deal with planetary motion (or
simple projectile motion) since the planet should speed up as it nears
the Sun at the focal point of the ellipse and slow down as it move
away from the focal point. And of course a bouncing ball does not move
with uniform speed.
Someone at the conference asked about this speed issue (slow on the
desktop--much faster on the web) but I couldn't hear the answer, only
that it sounded like it was Kevin who responded. I suspect it must be
a matter of timing of the screen refresh rate. But I have no real
understanding of what goes on behind the scenes. Can anyone fill me in
on what Kevin said? And it still under consideration? It is surely
not a high priority at this early stage.
On the Mac there has been a longstanding problem in using repeat loops
to control the movement of screen objects. It is necessary to insert a
forced screen refresh every time through the loop on the desktop. That
problem goes away on the Web. A screen refresh is no longer needed.
The stack I wrote is very busy, lots of factors to vary in order to
compare all the possibilities. If you have the courage you can
compare these things for yourself on the desktop using the stack:
go url "http://jamesphurley.on-rev.com/OnRevGraphicTimer.rev"
And on the Web, go to
http://jamesphurley.on-rev.com/OnRevTimer/test.html
The stack is a little busy. Jim Hurley
(P.S. On the third card of the stack above I added is a simulation of
planetary motion. The speed is fine on the desktop and the motion is
very smooth, but it is WAY too speedy on the Web. I didn't include
any accommodation for the speed change on the Web. A good example of
the need to do so.
More information about the use-livecode
mailing list