Jump to content
Search Community

TweenProxy3D Orbit/Carousel Hack

rjr4321 test
Moderator Tag

Recommended Posts

Hi,

 

I apologize, upfront, for my lameness. I'm trying to figure out a simple animation (people icons rotating around globe icon) using the TweenProxy3D class.

 

I've looked at all the "tweenproxy3d" and "orbit" and "carousel" posts on this forum, but I am lost. I've also read the commented out documentation comments in the class. I'm not really sure if this is a tweening issue or a transformation issue.

 

Ideally I'd like to figure out how to carousel an array of swfs around a center swf -- like rotating moons around a rotating globe. I've have a bunch of failed flas and as files. I've attached one of the simpler ones.

 

Any pointers to discussions/tutorials I've missed greatly appreciated. Thanks!

 

--rob

Link to comment
Share on other sites

G'day mate,

 

Give this a shot. Just be sure to turn your world bitmap into a movieclip with an instance name called world. There's probably a better way to do this but this is just a quick bit of slapped together code. Hopefully gives ya an idea though.

Comments below too

 

-Zync

 

package 
{
import com.greensock.TweenMax;
import com.greensock.TweenProxy3D;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.geom.Vector3D;
import com.greensock.easing.Linear

/**
 * ...
 * @author Zync
 */
public class orbit3d extends Sprite 
{
	public var mc:MovieClip;
	public var world:MovieClip;
	private var tp:TweenProxy3D;

	public function orbit3d():void
	{
		//Create tweenproxy3d object
		tp = new TweenProxy3D(mc);
		//Center our 3D registration to the center of our stage
		tp.registration = new Vector3D(stage.stageWidth / 2, stage.stageHeight / 2, 0);
		//Run a looping tweenMax tween that does a check on Update
		TweenMax.to(tp, 5, { rotationY:360, repeat: -1, ease:Linear.easeNone, onUpdate:checkDepth } )
	}

	//Think function checks the rotation of our mc
	private function checkDepth():void 
	{
		//If the rotation if greater than 180, set the clip on top of our world
		if (mc.rotationY > 180)
		{
			stage.addChildAt(mc, 0);
		} else 
		{
			//Otherwise set the world on top
			stage.addChildAt(world, 0)
		}
	}
}
}

Link to comment
Share on other sites

To add any more objects to orbit, just create another Tweenproxy3D object and then more Tween Max tweens for each element.

 

As for for info. I don't know anything specific but I've linked a few below with an Aladdin's Cave of As3 treasure in them. Also following people on twitter is another great resource:

 

http://www.emanueleferonato.com/

http://blog.theflashblog.com/

http://www.ultrashock.com/

 

Twitters:

 

http://twitter.com/greensock/

http://twitter.com/leebrimelow

http://twitter.com/TH_Flash

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...