[Newbies] How to put a delay between Morph movements/changes ?
K K Subbu
kksubbu.ml at gmail.com
Thu Oct 24 05:46:42 UTC 2019
Nicola,
Morphic updates to Display are buffered, so you can't animate them
through delays. Morphic core already has built-in facilities to support
animation in an efficient way. There is an excellent tutorial by John
Maloney at:
http://sdmeta.gforge.inria.fr/FreeBooks/CollectiveNBlueBook/morphic.final.pdf
See the section on "Adding Liveness" (page 11) for the specifics.
HTH .. Subbu
On 24/10/19 5:03 AM, Nicola Mingotti wrote:
> Hi,
>
> I would like a Morph to move and then wait a bit, move and wait a bit
> ... and so on. I can't get it.
>
> For example, this code works as expected:
> ------------
> 1 to: 10 do: [:x |
> Transcript show: ('[{1} -- hello]' format: {x}); cr.
> (Delay forMilliseconds: 500) wait.
> ].
> --------------
>
> But once i try to put the Delay between a Morph changes it does not do
> what i want. That is, the morph does all the actions together at the end
> of the loop.
>
> ---------------------------
> e := PolygonMorph new.
> e openInWorld.
> e position: 300 at 300.
> e heading.
> e forward: 50.
>
> 1 to: 10 do: [:x |
> e forward: 10.
> (Delay forMilliseconds: 500) wait.
> ].
> ---------------------
>
> bye
> Nicola
>
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
More information about the Beginners
mailing list