Topic: menu demo with rotational physics

I just found this on my HDD a few days ago and thought maybe someone could use it. It was a P-O-C of a menu idea for a project I was working on but I never ended up using it for anything

http://www.devrhino.com/gearslinga_public.html

Looking at the source is pretty much an introduction to coding animation and using trig to calculate physics effects.

function turn_gear(which_tab)
{
	var gear:MovieClip = _root.gear_mc;
	var point:MovieClip = _root.point_mc;
	
	var coords:Object = {x:which_tab._x, y:which_tab._y};
	gear.localToGlobal(coords);
	gear._tab = which_tab;
	gear._speed = 5;
	gear.onEnterFrame = function(){
		
		//this._rotation += 2;
		var coords:Object = {x:this._tab._x, y:this._tab._y};
		this.localToGlobal(coords);
		var xd_1:Number = _root.point_mc._x - coords.x;
		var xd_2:Number = coords.x - _root.point_mc._x
		var yd:Number = coords.y - _root.point_mc._y;
		var mult:Number = 1.5;
		var y_lim:Number = 100;
		if(_root.check_mc.selected){draw_triangle(this, coords)} else {_root.line_mc.unloadMovie();}
		
		var radians:Number = Math.atan2(xd_2, yd);
		var deg:Number = (radians * 180/Math.PI );
		trace(deg + " degrees");
		
		if(deg <= -1 || deg >= 1)
		{
			this._rotation -= (deg / 5);//this._speed;
		}  else {
			trace("DENIED: " + deg);
			delete this.onEnterFrame;
		}
		
		
	}
}

I don't get to do this type of fun stuff as much as I used to but I am really starting to miss it. Anyway, if anybody wants it I will post the FLA with the rest of the source, let me know.

-Rhino

Last edited by Rhino (2007-08-09 10:45:04)

Lord, give us the wisdom to utter words that are gentle and tender, for tomorrow we may have to eat them.   -Rep. Morris Udall

Re: menu demo with rotational physics

If you want to see some amazing genetic/physics/all mathy-ish Flash stuff then check out http://levitated.net (Click on 'Open Source' for all the good stuff)

Last edited by pnomolos (2007-08-10 10:59:20)

"Take up your cross before your crown" :: http://no-spec.com

Re: menu demo with rotational physics

holy cow! I've been out of the loop longer than I thought, apparently. that stuff is amazing

Lord, give us the wisdom to utter words that are gentle and tender, for tomorrow we may have to eat them.   -Rep. Morris Udall