Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
PrintOMatic
Impressario Find Dialog
Buddy Zip/Unzip
Export/Import Text and Filed Members for proofing
Animation on MouseUp
CapsLockXtra
MoonRaker
Generic MP3 Player
Loungin.net
cXtraTransitions3
 

 

 

Behavior Pulse Blend a Sprite

Added on 5/6/2008

 

Compatibilities:
behavior D8_5 D9 Mac PC Shockwave

This item has not yet been rated

Author: kenl (website)

Cyclically fades a sprite up and down when the sprite is rolled over.

   Download Mac Source
-- 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

Send e-mail