home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactive 20 / CMi20.iso / pc / sampler.dir / 00060_rollblend.ls < prev    next >
Encoding:
Text File  |  2000-03-28  |  1.7 KB  |  48 lines

  1. property startBlend, StartFadePoint, EndFadePoint
  2.  
  3. on beginSprite me
  4.   puppetSprite(me.spriteNum, 1)
  5.   set the blend of sprite the spriteNum of me to startBlend
  6.   updateStage()
  7. end
  8.  
  9. on exitFrame me
  10.   sendSprite(me.spriteNum, #blendit)
  11. end
  12.  
  13. on blendSprite which, what
  14.   set the blend of sprite which to what
  15.   updateStage()
  16. end
  17.  
  18. on blendit me
  19.   dv = abs(the locV of sprite me.spriteNum - the mouseV)
  20.   dH = abs(the locH of sprite me.spriteNum - the mouseH)
  21.   distance = sqrt((dv * dv) + (dH * dH))
  22.   if distance < EndFadePoint then
  23.     blendSprite(me.spriteNum, 100)
  24.     exit
  25.   end if
  26.   if distance < StartFadePoint then
  27.     percentage = distance * 100 / StartFadePoint
  28.     blendToValue = 100 - percentage
  29.     if blendToValue < startBlend then
  30.       blendToValue = startBlend
  31.     end if
  32.     blendSprite(me.spriteNum, blendToValue)
  33.     volume = blendToValue / 10
  34.   else
  35.     blendSprite(me.spriteNum, startBlend)
  36.   end if
  37.   updateStage()
  38. end
  39.  
  40. on getPropertyDescriptionList
  41.   p_list = [#startBlend: [#default: 0, #format: #integer, #comment: "Initial Blend", #range: [#min: 0, #max: 100]], #StartFadePoint: [#default: 100, #format: #integer, #comment: "Trigger Point", #range: [#min: 0, #max: 500]], #EndFadePoint: [#default: 0, #format: #integer, #comment: "End Trigger Point", #range: [#min: 0, #max: 50]]]
  42.   return p_list
  43. end
  44.  
  45. on getBehaviorDescription
  46.   return "Creates sprites that fade in and out (using the sprite blend property) depending how far they are from the mouse. " & RETURN & RETURN & "Try different inks for your sprites - different images require different settings. Also, there appears to be a bug in Director 6 that prevents sprites with a blend of 0 from being totally hidden. "
  47. end
  48.