[Q] What is the better way for wait between actions in Morph
Lic. Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Thu Sep 23 14:20:33 UTC 2004
|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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1428 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040923/768a6d3f/attachment.gif
-------------- next part --------------
'From Squeak3.7 of ''4 September 2004'' [latest update: #5988] on 23 September 2004 at 10:55:02 am'!
ImageMorph subclass: #ColoredMask
instanceVariableNames: 'misColores oldColor'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Puzzle'!
!ColoredMask methodsFor: 'as yet unclassified' stamp: 'edc 9/23/2004 10:50'!
changeColor
| newColor |
oldColor := self image colors at: 1.
newColor := (Color indexedColors) atRandom.
self image mapColor: oldColor to: newColor.
self addAlarm: #changeColor after: 1000.
! !
!ColoredMask methodsFor: 'as yet unclassified' stamp: 'edc 9/23/2004 10:53'!
initialize
|f |
super initialize.
misColores := Color indexedColors.
f := Form fromFileNamed: 'LOOSE.gif'.
f mapColor: Color black to: (Color r: 0.353 g: 0.548 b: 0.611).
self newForm: f.
self openCenteredInWorld.
self comeToFront.
self startStepping.
! !
!ColoredMask methodsFor: 'as yet unclassified' stamp: 'edc 9/23/2004 10:52'!
step
| newColor |
oldColor := self image colors at: 1.
newColor := (Color indexedColors) atRandom.
self image mapColor: oldColor to: newColor.
! !
!ColoredMask methodsFor: 'as yet unclassified' stamp: 'edc 9/23/2004 10:53'!
stepTime
^1000! !
More information about the Squeak-dev
mailing list
|