[Q] What is the better way for wait between actions in Morph
Lic. Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Fri Sep 24 13:53:06 UTC 2004
On 23/09/04 11:20, "Lic. Edgar J. De Cleene" <edgardec2001 at yahoo.com.ar>
wrote:
> |f oldColor img |
> f _ Form fromFileNamed: 'Macintosh
> HD:Users:edgar:Public:SqueakDevelop:LOOSE.gif'.
> img _ ImageMorph new.
> img newForm: f.
> img openCenteredInWorld.
> img comeToFront.
> Color indexedColors do: [ :c| oldColor _ img image colors at: 1.
> img image mapColor: oldColor to: c.
> (Delay forMilliseconds: 1000) wait.
> ActiveWorld displayWorld].
>
> Don¹t work.
>
> But:
>
> |f oldColor img |
>
> f _ Form fromFileNamed: 'Macintosh
> HD:Users:edgar:Public:SqueakDevelop:LOOSE.gif'.
> Transcript open.
> img _ ImageMorph new.
> img newForm: f.
> img openCenteredInWorld.
> img comeToFront.
> Color indexedColors do: [ :c| oldColor _ img image colors at: 1.
> img image mapColor: oldColor to: c.
> (Delay forMilliseconds: 1000) wait.
> Transcript show: oldColor printSring;cr.
> ActiveWorld displayWorld].
>
> Works
> So , what is a better way for doing this ?
> Variants as World restoreMorphicDisplay don't works.
>
> I attach a stepping only variant, but color only change when I click on
> screen.
>
> Any clues for doing this single thing ?
>
> Edgar
>
>
>
>
>
>
>
I think find a solution
initialize
|f |
super initialize.
f := Form fromFileNamed: 'LOOSE.gif'
self newForm: f.
self openCenteredInWorld.
self comeToFront.
self addAlarm: #changeColor after: 1000.
changeColor
| newColor |
self hide.
oldColor := self image colors at: 1.
newColor := Color random.
self image mapColor: oldColor to: newColor.
self addAlarm: #changeColor after: 1000.
self show
Maybe I asking too basic questions, sorry.
Edgar
More information about the Squeak-dev
mailing list
|