scripting simultaneity
Sarah Reichelt
sarahr at genesearch.com.au
Thu Jul 8 22:47:18 EDT 2004
I think you need to use a send in time message. Basically, each gif
will have a goToNextFrame hander which will advance to the next frame
or back to frame 1 of it is at the end. Then you can use a line like:
send "goToNextFrame" to img "Gif A" in gSpeedA ticks (or milliseconds)
were gSpeedA is a global variable that contains the current speed
setting for gif A.
Your start button will set both gSpeedA & gSpeedB to the initial time
between frames.
In each image's script (written in pseudo-code, you'll have to convert
it into proper Transcript):
Gif A:
on goToNextFrame
set the frame counter to the next frame (or back to 1)
increment gSpeedA until it reaches your stopping time
send "goToNextFrame" to me in gSpeedA ticks unless it has reached the
stop time
end goToNextFrame
Gif B:
on goToNextFrame
set the frame counter to the next frame (or back to 1)
increment gSpeedB if gSpeedA is at the stopping time
send "goToNextFrame" to me in gSpeedB ticks unless it has reached the
stop time
end goToNextFrame
Cheers,
Sarah
On 8 Jul 2004, at 2:19 pm, kweto wrote:
> Hello,
>
> On my stack, clicking a single button causes two animated gifs
> (spinners) to
> start moving frame by frame. Moreover, because frame speeds for both
> these
> "spinner" images need to randomly vary and thereby reproduce a
> "natural"
> slowing down effect, that same start-button's script uses "set the
> currentFrame to x" to step the gif's thru each frame instead of merely
> letting them run their course "naturally" at their own built-in frame
> speed.
>
> Anyway, that part of the script I've got worked out -- thanks to prior
> advice from the list. The difficulty now is how to script a
> simultaneous
> effect within the one button's script, so that one spinner keeps
> spinning at
> a constant rate while the other spinner begin to slow down and
> eventually
> stop, at which point the first spinner too begins to slow and stop.
>
> That sounds confusing even to me, so maybe I should outline the basic
> overall process I'm after:
>
> ----------------------
> (STEP 1)
> Click a start button to begin moving animated gif A and animated gif B
> at
> the same per-frame rate;
>
> (STEP 2) When the start button is released:
> (a) animated gif A begins to slow down at a randomly
> set"deceleration"
> speed, while
> (b) animated gif B continues spinning in the background at a constant
> rate;
>
> (STEP 3) When animated gif A is eventually stopped, animage gif B also
> begins to "decelerate" at a randonly set per-frame speed, and
> eventually
> stops.
>
> (STEP 4) Display the two results as determined by each animated gif's
> final
> position (i.e., its currentFrame property)
> -----------------------
>
> I hope that all makes sense :-)
>
> Cheers,
>
> Nicolas Cueto
> (Nihon)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>
More information about the use-livecode
mailing list