Jump to content
GreenSock

rosmediapp

Members
  • Posts

    8
  • Joined

  • Last visited

rosmediapp's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. My version is: 12.1.5 (latest?) And.. it's working with immediateRender
  2. Let's say I have animation like this: timeline .add(TweenMax.fromTo(this, 3.5, {frameLabel: "anim_leave_screen"}, {frameLabel: "anim_leave_screen_end", ease: Linear.easeNone})) .add(TweenMax.fromTo(this, 3.5, {frameLabel: "anim_enter_screen"}, {frameLabel: "anim_enter_screen_end", ease: Linear.easeNone})); I think it's pretty straight-forward. It should work in my opinion like this: 1) [time 0.0] jump to frame with label "anim_leave_screen", 2) [time 0.0] play to frame with label "anim_leave_screen_end" for 3.5 seconds, 3) [time 3.5] jump to frame with label "anim_enter_screen", 4) [time 3.5] play to frame with label "anim_enter_screen_end" for 3.5 seconds. But second tween immediately after adding jumps to frame "anim_enter_screen". I know there are other way to get this around (4x TweenMax.to), but shouldn't it working as I think? Also as far as I remember TweenMax.set works the same "bad" way.
  3. Thanks for explanation, now I see. Maybe is there any method to hook movieclip again? Also I don't want to create new topic, but I have a question about TweenMax.set function: I have timeline and I want to do something like this tLine .add(TweenMax.set(mc, {visible: true})) .add(TweenMax.to(mc, .1, {y:"-=1", yoyo:true, repeat:5, repeatDelay:.2})) .add(TweenMax.set(mc, {visible: false})); But it doesn't work as expected, because mc is not showing. If I change 3rd tween to TweenMax.to(mc, .05, {visible: false}) it works well, so it needs some time delay. So set function always works immediately and doesn't respect timeline order?
  4. Hi, I'm making a game, where kid can click for example duck and it has few animations. Each click random animation is being played, though I've discovered a little problem, here's my code: private function clickDuck(evt:MouseEvent):void { lastAction = (new Date()).time; duckTimeline.time(0); duckTimeline.clear(); if(channelDuck != null) channelDuck.stop(); var number:int = FlashMusic.getRandom(soundiDuck.length); var sound:Sound = soundsDuck[number]; var tLine:TimelineMax = duckTimeline; duckSound(sound); if(number == 0){ tLine .add(TweenMax.to(duck.mouth, 0.033, {frame: 2}), 0) .add(TweenMax.to(duck.mouth, .262, {frame: 1}), 0.033) .add(TweenMax.fromTo(duck, 1, {frameLabel: "duckWalks"}, {frameLabel: "duckEnd", repeat:5, ease:Linear.easeNone}), 0) .add(TweenMax.to(duck, 3, {x:"+=50", repeat:1, yoyo:true, ease:Linear.easeNone}), 0) .add(TweenMax.to(duck, .05, {scaleX: -1}), 3) .add(TweenMax.to(duck, .05, {scaleX: 1}), 6); } else if(number == 1){ tLine .add(TweenMax.to(duck.mouth, 0.033, {frame: 2, repeat:1.5 * (16 + 7) - 1, repeatDelay:2 - 0.033}), 0) .add(TweenMax.to(duck.mouth, .262, {frame: 1, repeat:1.5 * (16 + 7) - 1, repeatDelay:2 - .262, onRepeat:duckSound, onRepeatParams:[sound]}), 0.033) .add(TweenMax.fromTo(duck, 1, {frameLabel: "duckWalks"}, {frameLabel: "duckEnd", repeat:3 * (16 + 7) - 1, ease:Linear.easeNone}), 0) .add(TweenMax.to(duck, 3 * 16, {x:1136 + duck.width / 2, ease:Linear.easeNone, onComplete:moveBack}), 0) .add(TweenMax.to(duck, 3 * 7, {x:duckX, ease:Linear.easeNone}), 3 * 16) } else{ var rotationPoint = new Point(-duck.wings.width / 2, 0); tLine .add(TweenMax.to(duck.mouth, 0.027, {frame: 2}), 0) .add(TweenMax.to(duck.mouth, .137, {frame: 1}), 0.027) .add(TweenMax.to(duck.wings, .3, {transformAroundPoint:{point: rotationPoint, rotation:"+=20"}, repeat:1, yoyo:true, ease:Sine.easeInOut}), 0) } } private function duckSound(sound:Sound){ channelDuck = sound.play(); } private function moveBack():void{ duck.x = -duck.width; } So. I've created new duckTimeline in class constructor. Then I've added CLICK event listener to call clickDuck. Function goes like this: 1) set timeline time to 0, 2) clear timeline, 3) stop previous sound, random new one 4) play sound and also 1 of 3 animations 4.1) this animation just opens duck's mouth for a while and takes and little walk (playing frames created in flash), then flip and go back 4.2) second animation: ducks walks to the end of screen, then moves instatly back and again walks to the start place. Also duck sometimes opens mouth and give a sound. 4.3) third animation: duck just opens mouth and the moves a wing a little the "duckWalks" animation is done in flash, however played using greensock as you can see. It's rotating duck legs and move rest of the body (wings included) a bit up and down. And here's a problem: when I play 4.3, even wait until it ends and the play 4.1 or 4.2 I can see wings are not moving along with the body anymore (they're not moving up/down). No matter what I do they won't move in frame animation, however 4.3 works still well. The only workaround I've found is to put wings movieclip in another movieclip and in 4.3 use the one from inside. However it's strange.. Regards
  5. Well, I thought I had last version, but I didn't. However even with the last version problem still occurs. Here's simple demo: http://speedy.sh/E3MQ9/demo.fla Run the code, check the logs, then comment first and uncomment second one and check the logs again
  6. Hi, I've weird thing when I was creating animation. Here's simplified code of my function (triggers when I click on object named "btnMikser"): //working private function clickMikser(evt:MouseEvent):void { var tLineMax:TimelineMax = new TimelineMax(); clearTweensFromMC([this.btnMikser]); trace(btnMikser.x + ", " + btnMikser.y); //prints: //899.5, 581.5 //899.5, 581.5 //and the same go on.. tLineMax .add( TweenMax.to(this.btnMikser, 0.05, {y:"-=6", x:"+=3", yoyo:true, repeat:89, ease:Power1.easeOut}) ) .add( TweenMax.to(this.btnMikser, 0.05, {rotation:3, delay:-4.5, yoyo:true, repeat:89, ease:Power1.easeOut}) ); } //bugged private function clickMikser(evt:MouseEvent):void { var tLineMax:TimelineMax = new TimelineMax(); clearTweensFromMC([this.btnMikser]); trace(btnMikser.x + ", " + btnMikser.y); //prints: //899.5, 581.5 //902.15, 576.1 //and so one it goes up.. tLineMax .add( TweenMax.to(this.btnMikser, 0.05, {y:"-=6", x:"+=3", yoyo:true, repeat:89, ease:Power1.easeOut}) ) .add( TweenMax.to(this.btnMikser, 0.05, {transformAroundCenter:{rotation:3}, delay:-4.5, yoyo:true, repeat:89, ease:Power1.easeOut}) ); } these are 2 versions of this function. What tween does is shaking an object. The only difference in second function is that I'm using transformAroundCenter. When I use it first it works well. But second time object is little shifted (as trace says also), third is even more etc. Here's clearTweensFromMC function: private function clearTweensFromMC( arrMC ) { for each (var mc:MovieClip in arrMC) { var arrTweens = TweenMax.getTweensOf(mc); for each (var t:TweenLite in arrTweens){ t.time(0); } } TweenMax.killTweensOf([arrMC]); } So I'm just reset tweens time to 0 and then kill them. I've also tried to create timeLine outside a function, pause it in 0, kill tweens and add new ones. The effect is the same. The only workaround for this that I'm using is to store x, y coords in btnMikser class in it's constructor and restore them each time I play animation. So: I'm searching for universal method to totally cancel all what tweens "did" to an object. This is because player must be able to click an object when he wants to, so animation has to be cancelled and replayed again. But even if I wait until animation finishes and then click it again object is shifted too (second function ofc). Any help will be appreciated, Regards
×