-- This behavior repeatedly makes a sprite fade and brighten
-- in opacity when the sprite is rolled over.
-- Works with any sprite that has a blend property.
-------------------------
-- Ken Loge 02-15-2002
-- http://dreamsteep.com
-------------------------
property pActivatePulseEffect -- whether the pulse effect is turned on or off
property pBlendValueState -- if the sprite is currently dimming or getting brighter
property pFadeStep -- the rate of the sprite blend change
on beginSprite me
pBlendValueState = #getDimmer
pActivatePulseEffect = FALSE
end
on getPropertyDescriptionList me
list = [:]
addProp list, #pFadeStep, [#comment: "Fade rate of sprite:", #format: #integer, #default: 5]
return list
end
on exitFrame me
pulseSprite(me)
end
on mouseEnter me
if pActivatePulseEffect = FALSE then
pActivatePulseEffect = TRUE
else
pActivatePulseEffect = FALSE
end if
end
on mouseLeave me
if pActivatePulseEffect = FALSE then
pActivatePulseEffect = TRUE
else
pActivatePulseEffect = FALSE
sprite(me.spriteNum).blend = 100
end if
end
-- pulse blend a sprite cyclically using a simple state switcher
on pulseSprite me
if pActivatePulseEffect = TRUE then
if pBlendValueState = #getDimmer then
sprite(me.spriteNum).blend = sprite(me.spriteNum).blend - pFadeStep
if sprite(me.spriteNum).blend < pFadeStep then pBlendValueState = #getBrighter
end if
if pBlendValueState = #getBrighter then
sprite(me.spriteNum).blend = sprite(me.spriteNum).blend + pFadeStep
if sprite(me.spriteNum).blend > (100 - pFadeStep) then pBlendValueState = #getDimmer
end if
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA