[Newbies] Morphic - How to animate without defining #step ?

Oscar Nierstrasz oscar.nierstrasz at gmail.com
Sun Jan 20 10:29:28 UTC 2008


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 ...)

- on




More information about the Beginners mailing list