|
|
|
Animate Image Sequence
Added on 4/20/2000
|
The sprite will swap images at a steady rate, regardless of any updateStage commands (unlike film loops).
Place this script on the sprite to animate, then set the rate you want it to animate at, and the number of images to animate.
To use the script, sendSprite(whichSprite, #toggleBlink).
property blink, anim, animStart, animEnd, rate, inum, spriteNum, mySprite
global trackAnim
on beginsprite me
mySprite = sprite(spriteNum)
blink = TRUE
animStart = mySprite.membernum
animEnd = animStart + (inum-1)
anim = animStart
trackAnim = anim
end beginsprite
on enterframe me
if blink = TRUE then
anim = anim + rate
trackAnim = anim
if anim > (animEnd+1) - rate then
anim = float(animStart)
end if
mc = the number of chars of (string(anim)) - (the floatPrecision + 1)
theMem = value(char 1 to mc of string(anim))
mySprite.membernum = theMem
else
nothing
end if
end enterframe
on getPropertyDescriptionList me
pList = [:]
pList.addProp(#rate, [#format:#float,#default:.2,#comment:"Rate:"])
pList.addProp(#inum, [#format:#integer,#default:2,#comment:"Image Num:"])
return pList
end getPropertyDescriptionList
on toggleBlink me
blink = NOT blink
end
|
|