// Valores iniciales del parámetro t:
//inicio = 0;		// valor inicial de t
mueve = false;	// la acción está parada al iniciarse el programa
espera = 50;	// milisegundos de intervalo del reloj (la acción se ejecuta cada 50 milisegundos, o sea, 20 "fotogramas" por segundo)
paso = 0.019;	// incremento del tiempo en cada ejecución 

// Nota importante: para evitar "singularidades" (errores de Java)
// NO PONER PASO = 0.1 PUES 0.1 EN BINARIO NO ES EXACTO: 0.1 (decimal) = .0001100011000111000111… (binario)
			
// Programa
t = inicio;    // Comenzamos: el tiempo toma su valor inicial por defecto	
reloj = null;		// Se crea un reloj virtual

function ini() {
	inicio = document.Primos.getValue("zAngRot");
	t = inicio;
	avanza();
}

function reinicio() {	
	setTimeout("clearInterval(reloj)", 0);
	mueve = false;
	t = inicio;
	document.Primos.evalCommand("zAngRot=2 Pi - Angulo[(-5, 5), (-6, 5), XY]");
	
}

function retrocede() {	
	if (!mueve){
		mueve = true; 
		reloj = setInterval("atras()", espera);
	}
}

function avanza() {	
	if (!mueve){
		mueve = true; 
		reloj = setInterval("adelante()", espera);
	}
}

function pausa() {
	if (mueve){
		mueve = false; 
		setTimeout("clearInterval(reloj)", 0);	
	}
}

function adelante() {
	t = t - paso;
	document.Primos.evalCommand("zAngRot=" + t);
}

function atras() {	
	t = t + paso;
	document.Primos.evalCommand("zAngRot=" + t);
}


