TSpeaker


Croquet-Teapot

Comment:

TSpeaker is used to show that an avatar has voice chat enabled and the voice speaker volume.

Hierarchy:

ProtoObject
Object
TObject
TFrame
TGroup
TSpeaker

Summary:

instance variables:

animateTime color enable frame persist strength

methods:

instance class
accessing action initialize stepping testing instance creation

Detail:

instance variables:

animateTime
color
enable
frame
persist
strength

instance methods:

accessing
color: col

	color _ col.
	frame colorize: color.
fadeDelay

	^2500.0  "2.5 seconds"

action
disable

	animateTime _ Croquet teaTime + self fadeDelay.
enable


	self color: TButton overColor.
	frame solidVisibleTree: true. 
	animateTime _ nil.
signalVolume: str


"	self color: TButton overColor copy."
	self color: TButton hiliteColor copy.
	frame solidVisibleTree: true. 
	strength _ 0.25 + (2*str/ 32768.0).
	strength > 0.99 ifTrue:[strength _ 0.99].
	animateTime _ Croquet teaTime + self fadeDelay.
	frame setAlpha: strength.

initialize
initializeWithFrame: fr


	super initialize.
	frame _ fr.
	frame ifNotNil:[ frame objectOwner: self.].
	self addChild: frame.
	self color: TButton normColor.
	persist _ false.
	frame solidVisibleTree: false.
	animateTime _ nil.
	enable _ false.
	strength _ 1.0.
	^self

stepping
step


	"interpolate color"
	| timeLeft |
	animateTime ifNotNil: [
		timeLeft _ animateTime - Croquet teaTime asFloat.
		timeLeft <= 0 ifTrue: [ 
			animateTime _ nil. 
			frame solidVisibleTree: false. 
			]
		ifFalse: [ color at: 4 put: strength * timeLeft asFloat / self fadeDelay.].
		self color: color.
		].
wantsSteps


	^ true.

testing
isComponent


	^ true.
isSolid


	^ false.

class methods:

^top


- made by Dandelion -