Shrink Image quickly
Dar Scott
dsc at swcp.com
Mon Jan 6 07:36:01 EST 2003
On Sunday, January 5, 2003, at 11:08 PM, Sannyasin Sivakatirswami wrote:
> set the width of image "shrinkTest" to (x - 1)
> set the height of image "shrinkTest" to (y - 1)
Perhaps this can be set based on the fraction of the target shrink time.
Pick a target shrink time, say, 1.5 seconds. Remember the long seconds
or the milliseconds at the start. At this point of your code get it
again and find out how much time has passed. Get the fraction of the
target time. Get the same fraction of the dimensions rounding down.
(Make sure the first one shrinks some amount.) Use that.
Set the send delay to the target time divided by the largest dimension
and send _before_ the computation. If you need to get mouse clicks
during that time, perhaps you can set the delay to 5 ms and send it
after the computation, just before the handler end; you may want to
check that the new size is not the same as the old one in this case.
Slow computers will see a stepwise shrinking and fast computers will
see a smooth shrinking. If the engine changes, this will adapt. The
number of steps will also adapt to other sends and callbacks keeping
things busy.
Dar Scott
More information about the use-livecode
mailing list