[Newbies] Morphic - How to animate without defining #step ?
Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Sun Jan 20 12:24:49 UTC 2008
El 1/20/08 7:29 AM, "Oscar Nierstrasz" <oscar.nierstrasz at gmail.com>
escribió:
>
> Hi Folks,
>
> I have been struggling with Morphic animation.
>
> I would like to animate some different algorithms that compute
> solutions to various puzzles. (It is for an introduction to Squeak for
> high school students.)
>
> Normally animations in Morphic are done by defining the #step method.
> But in this case I want to animate various stages of an algorithm. I
> cannot split the algorithm into bits and pieces that can be evaluated
> by #step without destroying the algorithm. I have tried to update the
> morph from within the algorithm (i.e., by changing the color of
> various submorphs) but this does not work. I only see the final state.
>
> Can anyone tell me if what I want to do is even possible? Any
> pointers to some existing application that does this?
>
> If you want to see what I am trying to do, look at
> Mazemorph>>shortestPath in http://www.squeaksource.com/SOI.html
>
> MazeMorph soi openInWorld; shortestPath
>
> There is a simple BoardMorph made up of CellMorphs, specialized to
> search through a maze and find the shortest path. I would like to
> animate the depth-first searching, but I can only display the final
> state. There are other algorithms I would like to animate, but this
> is a typical case.
>
> (I thought of evaluating the algorithm as a separate process, with
> pauses at key points, and using #step to continue to the next pause,
> but that seems like overkill to me. There must be an easier way ...)
Oscar:
Exist one solution for you evaluate and see if meet your requirements.
self addAlarm: #continue after: self delayTime
for any Morph
delayTime should be a instvar of the derived Morph.
Or you could have some more complicated.
Wish tomorrow I see you code for ideas ?
Edgar
More information about the Beginners
mailing list