Jump to content
GreenSock

jefinho

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by jefinho

  1. Just one more question.

    Is it possible that the ShortRotation plugin will mess things up? In the following code I will rotate an object to a specific position using the ShortRotation plugin:

     

    private function buildRotationTween(mc:DisplayObject, rot:Number):TweenMax
    	{
    		var rotSpeed:Number = 5;//degrees per second
    		var specRotation:Number = rot;
    		var rotationChange:Number = specRotation - mc.rotation;
    		var duration:Number = Math.abs(rotationChange / rotSpeed);
    		return new TweenMax(mc,duration,{shortRotation:{rotation:specRotation},ease:Linear.easeNone,onComplete:countMovements});
    	}
    

     

    I'm using this, because I want my object to rotate the shortest distance possible to the given position.

  2. Thank you for your reply.

    For as far I can see this won't work within this concept - but I'm not a mathematician.

     

    In my idea there are 32 elements rotating at the same time to a random location. This will not happen once, but - in theory - infinite. So when all the 32 elements are finished with a rotation, they will rotate to a new position, etc, etc.

    In all cases, the rotation speed has to be the same, no matter how many times the final rotation destination has changed.

     

    Maybe I just don't understand the way tweenLite, or your math-solution works.

    Anyhow, thanks for your help.

  3. Thanks for your reply.

    I'm not sure if that will help.

    It's pretty hard to explain what I am trying to accomplish. Maybe some code will clear things up.

     

    I have 8 movieClips (_family) containing 4 elements (m). Those 4 elements have to rotate at the same speed, independent of the distance they have to take.

    The elements rotate to a random position, and when the position is reached the "countMovements" function will be called. This function checks if all the elements are at their final distention.

    When that happens, the process starts all over again, with new positions to rotate to. This is done by recalling the randomMemberRotation function.

     

    private function randomMemberRotation():void
    	{
    		for (var i:uint = 1; i<=8; i++)
    		{
    			var f:MovieClip = this["_family" + i];
    			// randomDir gives a number between 0 and 360
    			var randomRot1 = randomDir();
    			var randomRot2 = randomDir();
    			var randomRot3 = randomDir();
    			var randomRot4 = randomDir();
    			// rotSpeed is a number, lets say 5
    			// countMovements checks if the 32 elements are at their final distination
    			twM1 = new TweenMax(f.m1,rotSpeed,{rotation:randomRot1,repeat:0,ease:Linear.easeNone,onComplete:countMovements});
    			twM2 = new TweenMax(f.m2,rotSpeed,{rotation:randomRot2,repeat:0,ease:Linear.easeNone,onComplete:countMovements});
    			twM3 = new TweenMax(f.m3,rotSpeed,{rotation:randomRot3,repeat:0,ease:Linear.easeNone,onComplete:countMovements});
    			twM4 = new TweenMax(f.m4,rotSpeed,{rotation:randomRot4,repeat:0,ease:Linear.easeNone,onComplete:countMovements});
    		}
    	}
    }
    
    }
    

     

     

    So, how can I realize a "fixed" speed for the elements - no matter how far the distance is?

    Thank so much trying to help!

  4. Hi there,

     

    I'm trying to rotate a number of objects through TweenLite into different directions. Some objects have to bridge a greater distance than others, so they must move faster within a fixed time. Thereafter, the same objects - which have bridged a longer distance before - can bridge a shorter distance which makes them move slower.

    I would like the speed of rotation always the same, regardless of the distance they must bridge. Is this possible?

     

    I've looked to this option:

    http://www.kirupa.com/forum/showthread.php?t=332600

     

    But I guess it's a little too limited for me, because my animation is continuous. So the objects rotate all the time (using onComplete:pickAnotherRotation). Sometimes a big rotation, sometimes a small rotation.

     

    Can anyone give me some idea's?

    Thanks!

  5. Fist of all: Thanks for trying to help!

     

    I made a little sketch to visualize what I am trying to accomplish.

    The blue line must rotate to 90 degrees in counter clockwise direction. The green line is at the correct end position. The red line is the incorrect end position.

     

    As you can see; the lines must move in relation to the circle in the back.

     

    example.jpg

     

    Somehow I can't get this to work with a simple function.

    Maybe something like this:

    private function getRotationChange(currRot:Number, clockwise:Boolean):Number
    	{
    		if (!clockwise)
    		{
    			currRot = -360 - currRot;
    		}
    		return currRot;
    	}
    

     

    I hope you can give an advise.

  6. Hi there!

     

    If have a basic question about the way I should handle rotation within TweenMax.

    I'm making an animation that looks like a clock with many pointers.

    The pointers can move in diferent directions; clockwise and counterclockwise.

     

    This pointer should go to the same position

    var twM1:TweenMax = new TweenMax(myPointer,5,{rotation:180,repeat:0,ease:Linear.easeNone});
    

    as this pointer:

    var twM2:TweenMax = new TweenMax(myPointer,5,{rotation:-180,repeat:0,ease:Linear.easeNone});
    

     

    The direction of tween 1 is clockwise, and the direction of tween 2 is counterclockwise.

    Of course, this will not happen, because the values are different now (180 and -180).

     

    I'm working with an XML-database that gives me a negative number when a pointer needs to go counterclockwise,

    and a positive number when a pointer needs to go clockwise.

     

    I looked to the TransitionManager of Adobe. Here I can turn "ccw" on or off:

    TransitionManager.start(img1_mc, {type:Rotate, direction:Transition.IN, duration:3, easing:Strong.easeInOut, ccw:false, degrees:720});

     

    Can this be realized in TweenLite/Max?

     

    Thanks!

  7. Hi there,

     

    I have a problem with the dynamicProps plugin. When I launch the application, I get an error:

    TypeError: Error #1006: value is not a function

    at com.greensock.plugins::DynamicPropsPlugin/set changeFactor()

    at com.greensock::TweenMax/renderTime()

    at com.greensock.core::SimpleTimeline/renderTime()

    at com.greensock::TweenLite$/updateAll()

     

    This is the part of my code that is causing the problem:

     

    private function taskTween():void
    	{
    		for (var i:uint = 1; i <= 8; i++)
    		{
    			// 8 mc that each contain 4 elements (m1 till m4) that must be animated (rotate)
    			var f:MovieClip = Globals.vars["_family" + i];
    
    			// get the value of rotation for each element out of XML (XML-load-function not added to this example)
    			// and put that in a var (r1 till r4).
    			var r1:int = this["a" + i + "_p1"];
    			var r2:int = this["a" + i + "_p2"];
    			var r3:int = this["a" + i + "_p3"];
    			var r4:int = this["a" + i + "_p4"];
    			trace(i+": r1: "+r1 +" r2: "+ r2 +" r3: "+ r3 +" r4: "+ r4);
    			// Now something goes wrong with dynamicProps
    			// when I try to animate one (m1) element within a mc (f). 
    
    			var twM1:TweenMax = new TweenMax(f.m1,2,{dynamicProps:{rotation:r1},repeat:0,ease:Linear.easeNone});
    
    			//While this is working fine:
    			var twM2:TweenMax = new TweenMax(f.m2,2,{rotation:r2,repeat:0,ease:Linear.easeNone});
    			var twM3:TweenMax = new TweenMax(f.m3,2,{rotation:r3,repeat:0,ease:Linear.easeNone});
    			var twM4:TweenMax = new TweenMax(f.m4,2,{rotation:r4,repeat:0,ease:Linear.easeNone});
    
    			// I need dynamicProps to work because the rotation will change dynamicly 
    		}
    	}
    

     

    What am I doing wrong?

    Is it because I am trying to tween more than one mc at the time?

     

    Thanks!

    Jef

×