Skip to main content
JonnyDL-HV74P1
Inspiring
October 11, 2010
Answered

Help with shadow animation

  • October 11, 2010
  • 1 reply
  • 824 views

I'm having a bit of a difficulty animating a shadow. I have several pieces of art on the stage with a shadow on them. I have them on a tween, that will enlarge them (one at a Time) from there current state (100%) to (300%). What I'm trying to do is as the art increases in scale the shadow decreases to nothing, and on the return tween will increase the shadow back to the original setting.

I'm able to get the shadow the fade out, but its not smooth, or precise enough (may have something to do with the timimg of the tween itself), then there is the problem of animating the shadow back on the scale down.

here is the code I have that I have been trying to get that effect

//Function called by an enterframe listener so the shadow will change every frame

function drawshadow (e:Event):void

{

makeShadow = new DropShadowFilter();

makeShadow.distance = 5;

makeShadow.angle = 80;

makeShadow.color = 0x333333;

//figured the alpha was the easiest filter to change for the animation I want

makeShadow.alpha = changeshadow

makeShadow.blurX = 2;

makeShadow.blurY = 2;

makeShadow.strength = 1

makeShadow.quality = 15;

makeShadow.inner = false;

makeShadow.knockout = false;

makeShadow.hideObject = false;

//if the stamp is  scaling up in the range the alpha decreases (note:the tween to enlarge is .5)

if (stamp.scaleX > 1 && stamp.scaleX<3)

{

changeshadow = changeshadow-.03

stamp.filters = new Array(makeShadow)

}

}

This topic has been closed for replies.
Correct answer kglad

then use the tween class to tween some object property and use a motionchange event to update your dropshadow.

1 reply

kglad
Community Expert
Community Expert
October 11, 2010

it's generally a bad idea to mix timeline tweening and actionscript tweening for any one object.  you should use all timeline tweening or all actionscript tweening.

JonnyDL-HV74P1
Inspiring
October 11, 2010

I am using all as3 for the animantion. I have  two functions containingg tweens that scales up and down based on a timer to trigger

One tween to another (and repeat)

this is what I'm using for the scale up tween if it helps

stampScaleX=new Tween(stamp, "scaleX", Strong.easeIn, 1, howLarge, .5, true)

stampScaleY=new Tween(stamp, "scaleY", Strong.easeIn, 1, howLarge, .5, true)

HowLarge is = 3 (300%)

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
October 12, 2010

then use the tween class to tween some object property and use a motionchange event to update your dropshadow.