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 _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
El 1/20/08 7:29 AM, "Oscar Nierstrasz" <[hidden email]> 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 _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by onierstrasz
Hello Oscar,
not sure if I understand you correctly but if I need something displayed *now* I either use bitBlt (as long as its only simple rectangles) or World>>doOneCycleNow. Reading the comment there it sholdn't be done this way but whenever I have a busy algorithm and I want the display refreshed it works for me. Cheers Herbert mailto:[hidden email] _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Cool! That works. I added redraw doRedraw ifTrue: [self currentWorld doOneCycleNow] doRedraw doRedraw := true. dontRedraw doRedraw := false. so I can turn redrawing on and off. - on On Jan 20, 2008, at 13:07, Herbert König wrote: > Hello Oscar, > > not sure if I understand you correctly but if I need something > displayed *now* I either use bitBlt (as long as its only simple > rectangles) or World>>doOneCycleNow. > > Reading the comment there it sholdn't be done this way but whenever I > have a busy algorithm and I want the display refreshed it works for > me. > > > Cheers > > Herbert mailto:[hidden email] > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |