YOU CAN HELP [was: Re: New 3.0 gamma image available for test]

Yoshiki Ohshima ohshima at is.titech.ac.jp
Fri Feb 16 00:09:30 UTC 2001


  Hi,

> ***If anyone comes forward with a similar Squeak logo
> whose eyes follow the mouse, I will put it in.

  Fortunately, we already have this:-)

  What Torsten Bergmann did was using my implementation of
"eye."  He embedded the instances at the right position of
the mouse.

  Attached is a revised version of MovingEyeMorph.  (At the
time I wrote it, there was no EyeMorph in the base
image...).

  File in the attachment and evaluate the following 5 lines
in a Workspace.

    left _ MovingEyeMorph new openInWorld.
    right _ MovingEyeMorph new openInWorld.
    origin _ 482 at 34.
    left position: (origin + (77 at 74)).
    right position: (origin + (129 at 76)).

  The default extent 26 at 33 of MovingEyeMorph is based on the
size of mouse in 3.0gamma2.  "origin" is the position of the
FlashCharacter and the "77 at 74" and "129 at 76" is the offset
from it.  Then you may want to embed those eyes to the
FlashCharacter.

  Hope this helps,

  BTW, he (she?) deserved to have its own name!

  -- Yoshiki
-------------- next part --------------
'From Squeak3.0 of 4 February 2001 [latest update: #3512] on 15 February 2001 at 4:04:29 pm'!
EllipseMorph subclass: #MovingEyeMorph
	instanceVariableNames: 'inner iris '
	classVariableNames: 'IrisSize '
	poolDictionaries: ''
	category: 'Morphic-Eyes'!

!MovingEyeMorph methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 15:59'!
extent: aPoint

	super extent: aPoint.
	inner extent: (self extent * ((1.0 at 1.0)-IrisSize)) asIntegerPoint.
	iris extent: (self extent * IrisSize) asIntegerPoint.
	inner position: (self center - (inner extent // 2)) asIntegerPoint.
! !

!MovingEyeMorph methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 15:58'!
initialize

	super initialize.
	self color: Color black.
	inner _ EllipseMorph new.
	inner color: self color.
	inner extent: (self extent * ((1.0 at 1.0)-IrisSize)) asIntegerPoint.
	inner borderColor: self color.
	inner borderWidth: 0.
	iris _ EllipseMorph new.
	iris color: Color white.
	iris extent: (self extent * IrisSize) asIntegerPoint.
	self addMorphCentered: inner.
	inner addMorphCentered: iris.
	self extent: 26 at 33.
! !

!MovingEyeMorph methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 15:24'!
irisPos: cp

	| a b theta x y |
	theta _ (cp - self center) theta.
	a _ inner width // 2.
	b _ inner height // 2.
	x _ a * (theta cos).
	y _ b * (theta sin).
	iris position: ((x at y) asIntegerPoint) + self center - (iris extent // 2).! !

!MovingEyeMorph methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 15:28'!
step

	| cp |
	cp _ World primaryHand position.
	(inner containsPoint: cp) ifTrue: [
		iris position: (cp - (iris extent // 2)).
	] ifFalse: [
	    self irisPos: cp.
	]! !

!MovingEyeMorph methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 15:38'!
stepTime

	^ 100.! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MovingEyeMorph class
	instanceVariableNames: ''!

!MovingEyeMorph class methodsFor: 'as yet unclassified' stamp: 'yo 2/15/2001 16:04'!
initialize
"
	MovingEyeMorph initialize
"
	IrisSize _ (0.42 at 0.50).! !


MovingEyeMorph initialize!


More information about the Squeak-dev mailing list