Jump to content
GreenSock

lastnerve

Members
  • Posts

    13
  • Joined

  • Last visited

lastnerve's Achievements

0

Reputation

  1. Thanks Carl. I sure had the wrong idea about onUpdateParams.
  2. I've used TweenMax for Actionscript and onUpdateParams with multiple params and had no problems. However, I guess I don't understand the syntax of multiple params in onUpdateParams for Javascript. The docs say that the params are an array, but if I code 'drawLine' to accept them as an array or as individual values it fails. The code below is simply test code and wouldn't actually require a tween at all. If I remove the second param from onUpdateParams it works. Please help. function drawLine(i,sx){ $("#p1").append("i = " + i + " " + "<br />"); } function tweenLine() {// TweenMax.to(this, .5, {x:0, onUpdate:drawLine, onUpdateParams:[0,x]}); } tweenLine();
  3. I downloaded and started using GSAP 3 days ago and I'm having the same problem with DreamWeaver CS4 and TweenMax.min.js. I started with a php page (index.php) with the following code in it: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>flashdatadesign :: Home</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="keywords" content="web design"/> <meta name="description" content="web design"/> <meta name="language" content="en"/> <script src="jquery/jquery-1.5.min.js" type="text/javascript"></script> <link href="fddcss.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"></div> </body> </html> and as soon as I added: <script type="text/javascript" src="js/TweenMax.min.js"></script> Dreamweaver crashes. I don't even get to save the file. I just wanted to report that I'm the having same problem as Barry.
  4. Great. I'll see if I can make that work in my app. Thanks.
  5. Hi Jack, Is there a way to write a "pauseTweensOf()" similar to Tweenmax.killTweensOf() only without actually killing the object's tweens?
  6. Wow, I wasn't expecting a response from you so soon. I figured I'd hear from you this afternoon maybe. 1. All dots the same name: clumsiness born of repetitive code modifications to solve the current problem; added "+ i". 2. tweens in a TimelineLite: so that I could use remove(); trying to make sure tween was removed in case garbage collection didn't occur. Removed the TimelineLite var. 3. dumpClips(): attempt to solve overloading problem; only way I could think of to dump the clips. Removed it. 4. I need to use allFrom() because allTo() would only allow me to move all the dots to the same location. I define the ending location of each dot on the root by rotating a line mc and getting the width and height. I would prefer to use allTo(), but my trig abilites are well beyond rusty. I didn't mean to imply that TweenMax was the problem. I think my code is the problem, and maybe there's more I can do to optimize. I tried loading the dot mcs on the root and reusing them each time the tween is called but there is no performance difference. The tween that I included in the code block is called from another tween. So here are both of them with updates to my previously posted code. If you have time to review and comment, I'd sure appreciate it. function movedot():Void { for(var i:Number = 0; i < 16; i++){ dot_mc = this.attachMovie("dot", "dot" + i, getNextHighestDepth()); dot_Array[i] = dot_mc; dot_Array[i]._alpha = 0; // _root.xcd_Array and _root.ycd_Array contain ending values for each dot_Array[i] dot_Array[i]._x = _root.xcd_Array[i]; dot_Array[i]._y = _root.ycd_Array[i]; } TweenMax.allFrom(dot_Array, 1, {_x:0, _y:0, _alpha:100, ease:Linear.easeNone, overwrite:false}); } // on _root //( leader_mc is a 2px circle that moves to a random x,y and calls movedot() onComplete ) var leader_Timeline:TimelineLite = new TimelineLite; leader_Timeline.append(new TweenLite(leader_mc, 1, {_x:aimPoint_x, _y:aimPoint_y, ease:Linear.easeNone, overwrite:false})); leader_Timeline.insert(new TweenLite(leader_mc, 1, {bezierThrough:[{_x:midpoint_x, _y:midpoint_y}, {_x:endPoint_x, _y:endPoint_y}], _alpha: 0, ease:Linear.easeOut, overwrite:false, onComplete: movedot}), .4); leader_Timeline.insert(new TweenLite(leader_mc, .5, {ease:Linear.easeNone, overwrite:false, onStart: playSound}), .2);
  7. I've been trying for about a week to get this fairly simple animation to run without overloading my old machine's CPU (1.8 gz, 1.5g RAM). A recent test on a machine with 2.4 gz and 4g RAM gave similar results. I know I'm doing something wrong but I sure need some help to figure out what it is. I launch the same tween with each click so a rapid clicker can launch as many as 5 tweens per second. Each tween has a duration of 1and all run well until about 5 rapid clicks, then everything starts to slow down. If I click about 20 times the animation stops for about 10 seconds, starts again, and then finishes the tweens that I launched. But, if I start clicking again then all the tweens start out dog slow and my machine stalls. So it looks as if my code is maybe using up all my RAM. The tween below uses a 2 px dot (attached 16 times) and moves each one radially so that it looks like an expanding cirlce of dots. Am I simply being too ambitious with the tweens? Also, does "TweenMax.allFrom" actually run a separate tween for each object in it's assigned array? Is it more efficient than running a separate tweenLite for each array object? var dot_Array:Array = new Array(); var dot_mc:MovieClip; var dot_Timeline:TimelineLite = new TimelineLite; function dumpClips():Void { for(var i:Number = 0; i < 16; i++){ removeMovieClip(dot_Array[i]); } remove(dot_Timeline); } function movedot():Void { for(var i:Number = 0; i < 16; i++){ dot_mc = this.attachMovie("dot", "dot", getNextHighestDepth()); dot_Array[i] = dot_mc; dot_Array[i]._alpha = 0; // _root.xcd_Array and _root.ycd_Array contain the ending positions for each dot dot_Array[i]._x = _root.xcd_Array[i]; dot_Array[i]._y = _root.ycd_Array[i]; } dot_Timeline.append(new TweenMax.allFrom(dot_Array, 1, {_x:0, _y:0, _alpha:100, ease:Linear.easeNone, overwrite:false, onComplete: dumpClips}, 0)); }
  8. Thanks for the reply. I understand what you mean about "import com.greensock.*;" not creating a performance hit; it didn't make sense to me either. However, there is a noticeable difference in one of my tween sequences when I use it. I can't explain why. I didn't mean that I want to run tweens concurrently; I meant to ask if there is a method of "chaining" tweens, i.e., one tween triggering the next in the sequence. However, after reading more about GS I see that such "triggering" is not necessary. I tried to use insertMultiple, but couldn't get it to work, so I'll keep trying. Thanks a lot for the help.
  9. I found one thing that slowed down my tweens. I started with: import com.greensock.*; // this code creates a performance hit and changed to this: import com.greensock.TweenLite; import com.greensock.TimelineLite; import com.greensock.TweenAlign; import com.greensock.easing.*; and my tweens now run faster and smoother. I'd still like to know if there's a better way to string several motions tweens together.
  10. I love this tween engine and I'd love to learn how to use it properly. The code below is my attempt to get an image of a baseball bat to swing. I got that far, but the movement is a little jerky. When I slowed it down (as in the code below) I could see that each tween clearly starts and stops instead of giving one continuous motion. So is there a way to write a single tweenLite that provides 5 or 6 different motions without the stops and starts? function swingBat(mc:MovieClip):Void { var startx = mc._x; var starty = mc._y; //create the timeline var bat_Timeline:TimelineLite = new TimelineLite({tweens: [new TweenLite(mc, 1, {_xscale:100, _yscale:80, _x:startx - 60, _y:starty + 20, _rotation:30, ease:Linear.easeNone}), new TweenLite(mc, 1, {_xscale:100, _yscale:100, _x:startx, _y:starty, _rotation:0, ease:Linear.easeNone}), new TweenLite(mc, 1, {_xscale:60, _yscale:100, _x:startx - 60, _y:starty - 40, _rotation:-90, ease:Linear.easeNone}), new TweenLite(mc, 1, {_xscale:100, _yscale:100, _x:startx - 120, _y:starty - 60, _rotation:-180, ease:Linear.easeNone}), new TweenLite(mc, 1, {_xscale:60, _yscale:100, _x:startx - 60, _y:starty - 40, _rotation:-90, ease:Linear.easeNone}), new TweenLite(mc, 1, {_xscale:100, _yscale:100, _x:startx, _y:starty, _rotation:0, ease:Linear.easeNone})], align:TweenAlign.SEQUENCE, onComplete:manageClick});
  11. I added OverwriteManager.init() but the results were about the same. I also added a few frames to allow the tweens to play out before the mouse click interrupted them. That helped a lot, but I still have more work to do. Thanks again for the help.
  12. Hi, thanks for the help. Yes, I read some on overwriting, and tried overwrite:0 and overwrite:2, but the results appear to be the same. I think this is the problem. A user can click the start button several times per second and the tweens aren't able to keep up with that pace on the same object/same property. I think I need to create an array of objects, each of which can be tweened separately (hopefully with the same series of tweens).
  13. Hi all, I'm new to AS3 but I've managed to get a small tween study working anyway. The code below is a simplified version of what I'm trying to do. The start button launches a series of 4 tweens each time it's clicked and there's no limit on the number of clicks. The tweens handle 3 different "circle" movieclips, each with a different size and color. The "flasher" tween in the code below allows the "circleRed_mc" (which has a duration of only .1) to show with each click, however in the more complex code that I'm trying to fix the "circleRed_mc" doesn't show if the button is clicked rapidly, even though the other 3 display. Do I need to add more copies of the circle objects to avoid the interference between the tweens, or do I need additional tweening functions, or both? A hopefully easier question is why does the last tween ("fadeCircle") not fade out to alpha:0? Here's the code: Frame 1: import gs.TweenLite; import gs.easing.*; import flash.display.MovieClip; var xcoord:Number = 200; var ycoord:Number = 400; var circleSmall_mc:circleSmall = new circleSmall(); addChild(circleSmall_mc); circleSmall_mc.y = ycoord; circleSmall_mc.alpha = 0; var circleRed_mc:circleRed = new circleRed(); addChild(circleRed_mc); circleRed_mc.y = ycoord; circleRed_mc.scaleX = 0; circleRed_mc.scaleY = 0; circleRed_mc.alpha = 100; var circleLarge_mc:circleLarge = new circleLarge(); addChild(circleLarge_mc); circleLarge_mc.y = ycoord; circleLarge_mc.scaleX = 0; circleLarge_mc.scaleY = 0; stop(); function startMovie(event:MouseEvent):void { this.play(); } playButton.addEventListener(MouseEvent.CLICK, startMovie); Frame 2: function leader(large_mc:MovieClip,small_mc:MovieClip,red_mc:MovieClip,xcd1:Number):void { small_mc.x = 575; small_mc.y = 700; small_mc.alpha = 100; TweenLite.to(small_mc, .5, {x:xcd1, y:ycoord, ease:Strong.easeOut, overwrite:0, onComplete: flasher, onCompleteParams: [large_mc,small_mc,red_mc,xcd1]}); } function flasher(large_mc:MovieClip,small_mc:MovieClip,red_mc:MovieClip,xcd2:Number):void { small_mc.alpha = 0; red_mc.x = xcd2; TweenLite.to(red_mc, .1, {scaleX:50, scaleY:50, alpha:0, ease:Strong.easeOut, overwrite:0, onComplete: showCircle, onCompleteParams: [large_mc,small_mc,red_mc,xcd2]}); } function showCircle(large_mc:MovieClip,small_mc:MovieClip,red_mc:MovieClip,xcd3:Number):void { red_mc.scaleX = 0; red_mc.scaleY = 0; red_mc.alpha = 100; large_mc.x = xcd3; large_mc.scaleX = 0; large_mc.scaleY = 0; large_mc.alpha = 100; TweenLite.to(large_mc, 1, {scaleX:1, scaleY:1, ease:Strong.easeOut, overwrite:0, onComplete: fadeCircle, onCompleteParams: [large_mc,small_mc,red_mc,xcd3]}); } function fadeCircle(large_mc:MovieClip,small_mc:MovieClip,red_mc:MovieClip,xcd4:Number):void { xcoord = setx(xcd4); TweenLite.to(large_mc, 1, {alpha:0, ease:Cubic.easeInOut, overwrite:0}); } function setx(xcd:Number):Number{ if (xcd < 800){ xcd += 200; } else { xcd = 200; } return xcd; } leader(circleLarge_mc,circleSmall_mc,circleRed_mc,xcoord);
×