Why is Konfabulator "Pretty?"
Bill Marriott
wjm at wjm.org
Sun Dec 4 06:48:31 EST 2005
"Bill Marriott" <wjm at wjm.org> wrote in message
news:dmuhsb$25h$2 at sea.gmane.org...
> I believe for certain that a widget like the Konfabulator clock could be
> done with Rev
LOL. Ok, I'm not so certain anymore.
I thought I would start by figuring out how to rotate a "hand" around the
way they do it in Konfabulator.
So, I made a pretty-looking hour hand in my drawing program, saved it as a
PNG, and imported it as a control into Revolution 2.6.1.
Then I wrote a very simple script:
on mouseup
repeat 12 times
rotate image "hourHand" by -30
end repeat
end mouseup
Boy was I astonished... the PNG file was totally distorted, more and more,
by each rotation. But even crazier, it took *forever!* In fact, each
iteration of the loop took exponentially longer and longer. Then the image
disappeared altogether! I went to the task manager and I found that Rev was
now using more than 512MB of RAM (for like a 12K PNG). I killed the process
and relaunched.
I gave the rotate command a closer look in the documentation. Apparently,
"some distortion is unavoidable" when rotating in non-90/180/270 degrees. I
should instead set the angle property of the image. No mention of crashing
Rev.
Well I did that,
set the angle of image "hourHand" to the angle of image "hourHand" - 30
and at least I'm not eating up RAM while destroying my bitmap anymore. But a
disappointing observation: even though the image is a PNG with a nice alpha
channel and partial transparency... I still get an ugly "jaggy" effect
around the edges when the hand's angle is not 0/90/180/270. Anyone know why
that is?
One more item I'm still looking into -- the angle property will rotate
around an object's center. But I need it to rotate around some point toward
the end of the object, where the hand is connected to the center post of the
clock. I guess I'll have to break out my trig books to figure out how to
reposition the hand after every rotation. (Or maybe... just make the PNG
perfectly square and position the hand off-center within that square...
yah... because I really hated trig.)
forging ahead...
Bill
More information about the use-livecode
mailing list