Task 07

"Krypton sucks."
martin voshell

 
								
// task 07
// martin voshell
	// 10/27/02								
// make a hella cool circle animation


// spinning horizontally moves the cube in the spin direction and further away
// spinning vertically moves the cube nearer
								
								
								
								
//initialize our integers used to calculate time on the x-axis for each math func.
								
		var x = 0;								
		var x1 = 0;								
		var x2 = 0;							
		var x3 = 0;
		
		
		
								
//=============================================
				
		
		//the function that calls for each circle to update each frame								
								
								
								
				function updateFrame() {

								circle._x = shiftx();
	   						    circle._xscale = scalex(); 
								circle._y = shifty(); 
								circle._yscale = scaley(); 
								
								} 
				
								//update each frame 
								circle.onEnterFrame = updateFrame; 
								
												
//============================================= 
								
								
				//translate horizontally smoothly 
								
								function shiftx(){ 
								
								
								
								//to make a sin wave:  
								
								//	wavelength = amplitude * periodicFunction((frequency * time) + phaseShift); 
								
								
									var frequency = 1; 
									var amplitude = 1; 
									var phaseShift = 0; 
								
								
									// keep taking the y value while x does not become negative, x always is > -1 
								
									if (x != -1){ 
								
												var t = (2 * Math.PI) * (x / Stage.width); 
												var sine = amplitude * Math.sin(frequency*t + phaseShift); 
								
											//return the y value 
								
												y = (sine * (Stage.height/2 )) + (Stage.height/2);	 
								
								
											//incr x 
												x=x+1; 
												
													} 
								
								return y; 
								
								} 
			
								
								
// crank the frequency of x scaling speed to make the spinning percept 
			
			
								function scalex(){ 
			
			
									var frequency = 4; 				
									var amplitude = 2; 
									var phaseShift = 0; 
								
								
								if (x1 != -1){
								
												var t1 = (2 * Math.PI) * (x1 / Stage.width); 
								
											//using cos here b/c that max and min of cos corresponds with min and max of sin in the shift 
								
												var coser = amplitude * Math.cos(frequency*t1 + phaseShift); 
												z = (coser * (Stage.height/4 )) + (Stage.height/2);	 
												x1=x1+1; 
									return z; 
								
								} 
		
		
		
							
// move all around in y space now 
								
																
								function shifty(){ 
								
									var frequency = 2; 
									var amplitude = 2; 
									var phaseShift = 0; 
								
								
									if (x2 != -1){ 
								
												var t2 = (2 * Math.PI) * (x2 / Stage.width); 
												var siner = amplitude * Math.sin(frequency*t2 + phaseShift); 
												m = (siner * (Stage.height/4 )) + (Stage.height/2);	 
												x2=x2+1; 
								
													} 
								
								return m; 
								
								} 
								
					
					
								
// crank the amplitude of y scaling speed to match the x scale and make a depth percept 
								
								
								function scaley(){ 
								
									var frequency = 4; 
									var amplitude = 2; 
									var phaseShift = 0; 
								
								
									if (x3 != -1){ 

												var t3 = (2 * Math.PI) * (x3 / Stage.width); 
											//using sin here to match up with the peaks of the xscaler 
												var seyen = amplitude * Math.sin(frequency*t3 + phaseShift); 
												a = (seyen * (Stage.height/4 )) + (Stage.height/2);	 
												x3=x3+1; 

								return a;
								}
inspiration

(save target as)