I have a simple morph in squeak smalltalk. I want to move it from x1,y1 to x2,y2 (animation) with 5 seconds (or 10 seconds)
is there a build in way to create animation in squeak smalltalk ?
Yes, there is a built in way:
Make a subclass of Morph and implement the two methods
A minimal example:
Morph subclass: #MovingMorph
instanceVariableNames: ''
classVariableNames: ''
category: 'MovingMorph'
MovingMorph>>stepTime
stepTime
^ 100
MovingMorph>>step
step
self position: self position + (1@1)
Now open a MovingMorph in the World (MovingMorph new openInWorld
) and control the animation with startStepping
and stopStepping
.