Karl Ramberg uploaded a new version of MorphicExtras to project Etoys:
http://source.squeak.org/etoys/MorphicExtras-kfr.53.mcz ==================== Summary ==================== Name: MorphicExtras-kfr.53 Author: kfr Time: 20 October 2011, 12:28:15 am UUID: a97c037e-846d-a94a-9ea9-fc2e4dc628df Ancestors: MorphicExtras-kfr.52 Some additions to AnimatedImagemorph. Its now possible to playn and stop animaton playback. Posibility to toggle the opaque setting from etoys as well. Currently the gif reader does not set opaque correctly so it's pure chanse if playback looks right. =============== Diff against MorphicExtras-kfr.52 =============== Item was changed: ImageMorph subclass: #AnimatedImageMorph + instanceVariableNames: 'images delays stepTime nextTime imageIndex stepper' - instanceVariableNames: 'images delays stepTime nextTime imageIndex' classVariableNames: '' poolDictionaries: '' category: 'MorphicExtras-AdditionalMorphs'! !AnimatedImageMorph commentStamp: '<historical>' prior: 0! I am an ImageMorph that can hold more than one image. Each image has its own delay time.! Item was added: + ----- Method: AnimatedImageMorph class>>additionsToViewerCategories (in category 'class initialization') ----- + additionsToViewerCategories + "Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories." + ^ #( + + (#'graphics' + ( + (slot isGifPlaying 'Whether the gif is playing' + Boolean readWrite Player getGifPlaying Player setGifPlaying:) + (slot opaque 'Whether the gif opaque' + Boolean readWrite Player getOpaque Player setOpaque:) + + )) + + ) + ! Item was added: + ----- Method: AnimatedImageMorph>>addCustomMenuItems:hand: (in category 'stepping and presenter') ----- + addCustomMenuItems: aMenu hand: aHand + super addCustomMenuItems: aMenu hand: aHand. + aMenu addUpdating: #steppingString action: #toggleStepping! Item was changed: ----- Method: AnimatedImageMorph>>initialize (in category 'private') ----- initialize nextTime := Time millisecondClockValue. imageIndex := 1. stepTime := 10. + stepper :=true. super initialize! Item was added: + ----- Method: AnimatedImageMorph>>setStepping: (in category 'stepping and presenter') ----- + setStepping: aBoolean + self wantsSteps ifFalse:[^false]. + stepper := aBoolean. + stepper ifTrue:[self startStepping] + ifFalse:[self stopStepping]. + + ! Item was changed: ----- Method: AnimatedImageMorph>>step (in category 'stepping and presenter') ----- step | form delay | + stepper ifFalse:[ self stopStepping]. images isEmpty ifTrue: [^ self]. nextTime > Time millisecondClockValue ifTrue: [^self]. imageIndex > 0 ifTrue: [ form := images at: imageIndex. form displayOn: self image at: 0@0 rule: ((self isOpaque) ifTrue:[Form paint] ifFalse:[Form erase]). ]. imageIndex _ imageIndex \\ images size + 1. form := images at: imageIndex. form displayOn: self image at: 0@0 rule: Form paint. self changed. delay := (delays at: imageIndex) ifNil: [0]. nextTime := Time millisecondClockValue +delay! Item was added: + ----- Method: AnimatedImageMorph>>steppingString (in category 'stepping and presenter') ----- + steppingString + ^ (stepper + ifTrue: ['<on>'] + ifFalse: ['<off>']), 'Stepping' translated! Item was added: + ----- Method: AnimatedImageMorph>>toggleStepping (in category 'stepping and presenter') ----- + toggleStepping + self wantsSteps + ifTrue: [stepper := stepper not]. + stepper ifTrue:[self startStepping] + ifFalse:[self stopStepping]. + + ! _______________________________________________ etoys-dev mailing list [hidden email] http://lists.squeakland.org/mailman/listinfo/etoys-dev |
Free forum by Nabble | Edit this page |