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
Quiz engine
Check valid date
LineHiLiter
CD Link
Card Shuffler
Kaboom!
Flashation Flash Menu Builder
Inspect
Bouncing Bevel Light-Alphamania
Auto Save and Load Text
 

 

 

Behavior Sprite Blender - Time

Added on 7/27/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: LukeWigley

Attach to a sprite to make it fade in or out over a specified period of time

-- Sprite Blender
-- By luke@medialight.com.au
-- July 99

property spriteNum, spriteRef, TicksForTransition, startTicks, endTicks, sBlend, eBlend, blendChange, holdForCompletion

on beginSprite me
  spriteRef = sprite(me.spriteNum)
  spriteRef.blend = sBlend
  blendChange = eBlend - sBlend
  startTicks = the ticks
  endTicks = startTicks + TicksForTransition
end

on endSprite me
  spriteRef.blend = eBlend
end

on exitframe me
  myProgress = (float(the ticks - startTicks)/TicksForTransition)
  if myProgress > .95 then myProgress = 1
  myBlend = sBlend + integer( blendChange * myProgress )
  spriteRef.blend = myBlend
  if holdForCompletion and (myProgress < 1) then go to the frame
end


----------

on getPropertyDescriptionList
  if the currentSpriteNum > 0 then defaultStartBlend = the blend of sprite(the currentSpriteNum)
  else  defaultStartBlend = 0
  defaultEndBlend = 100 - defaultStartBlend
  p_list = [:]
  addProp p_list, #TicksForTransition, [ #comment: "Number of ticks for the transition:", #format: #integer, #default: 120, #range: [#min:1, #max:1200]]
  addProp p_list, #sBlend, [ #comment: "Start blend:", #format: #integer, #default: defaultStartBlend, #range: [#min:0, #max:100]]
  addProp p_list, #eBlend, [ #comment: "Ending blend:", #format: #integer, #default: defaultEndBlend, #range: [#min:0, #max:100]]
  addProp p_List, #holdForCompletion, [ #comment: "Hold on frame until completion?:", #format: #boolean, #default: 0]
  return p_list
end

on getBehaviorDescription  
  msg = "Fades the sprite in or out using blends over a specified time span. "  & return & return
  put " - Specify the timespan for the transition" & return after msg
  put " - Specify the starting and ending blend values" & return after msg
  put " - Specify whether to hold on the frame until the transition complete" after msg
  return msg
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail