Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/01/2015, 11:46
RichardXavi
 
Fecha de Ingreso: enero-2015
Ubicación: Salinas
Mensajes: 1
Antigüedad: 9 años, 3 meses
Puntos: 0
Pregunta Lenguaje html centrar ruleta giratoria

Hola amigos por favor su ayuda necesito centrar la ruleta Giratoria y el saber como puedo colocar en otra parte el boton Girar entenderan que no se nada de lenguaje html, soy principiante y he podido manipular esto, con lo poco que se.

Estoy utilizando CHROME para abrir.

<body background="\Users\VAIO15FL\Desktop\DRLOOK\DOC.jpg ">
<sound src="\Users\VAIO15FL\Desktop\DRLOOK\music.wav">
<TBODY>
<TD align=right>
<TD rowSpan=0 align=right><CANVAS id=wheelcanvas width="650" height="550" align=right;></CANVAS>
<padding:0; margin:0 auto>

<SCRIPT type=application/javascript>
var colors = ["#FFE4E1",
"#FFFFF0",
"FFE4B5",
"#F6CECE", //"#F35B20",
"#FF69B4",
"#FFE4C4",
"#FFE4E1",
"#FFFFF0",
"FFE4B5",
"#F6CECE", //"#F35B20",
"#FF69B4",
"#FFE4C4",
"#FFE4E1",
"#FFFFF0",
"FFE4B5",
"#F6CECE", //"#F35B20",
"#FF69B4",
"#FFE4C4",
"#FFE4E1",
"#FFFFF0",
"FFE4B5",
"#F6CECE", //"#F35B20",
"#FF69B4",
"#FFE4C4",
"#FFE4E1",
"#FFFFF0",
"FFE4B5",
"#F6CECE", //"#F35B20",
"#FF69B4",
"#FFE4C4",
"#FFE4E1",
"#FFFFF0",];

var restaraunts = ["KIMBERLY",
" DEVIES",
"LA FABRIL",
" PEPSICO",
" UNIVERSAL",
" JAB. WILSON",
"KIMBERLY",
" DEVIES",
"LA FABRIL",
" PEPSICO",
" UNIVERSAL",
" JAB. WILSON",
"KIMBERLY",
" DEVIES",
"LA FABRIL",

" PEPSICO",
" UNIVERSAL",
" JAB. WILSON",
"KIMBERLY",
" DEVIES",
"LA FABRIL",
" PEPSICO",
" UNIVERSAL",
" JAB. WILSON",
"KIMBERLY",
" DEVIES",
"LA FABRIL",
" PEPSICO",
" UNIVERSAL",
" JAB. WILSON",
" KIMBERLY",
" DEVIES"];






var startAngle = 0;
var arc = Math.PI / 8;
var spinTimeout = null;

var spinArcStart = 16;
var spinTime = 0;
var spinTimeTotal = 0;

var ctx;

function draw() {
drawRouletteWheel();
}

function drawRouletteWheel() {
var canvas = document.getElementById("wheelcanvas");
if (canvas.getContext) {
var outsideRadius = 240;
var textRadius = 160;
var insideRadius = 75;

ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 400, 400);


ctx.strokeStyle = "silver";
ctx.lineWidth = 2;

ctx.font = 'bold 12 px Arial';

for (var i = 0; i < colors.length; i++) {
var angle = startAngle + i * arc;
ctx.fillStyle = colors[i];

ctx.beginPath();
ctx.arc(250, 250, outsideRadius, angle, angle + arc, false);
ctx.arc(250, 250, insideRadius, angle + arc, angle, true);
ctx.stroke();
ctx.fill();

ctx.save();
ctx.shadowOffsetX = -1;
ctx.shadowOffsetY = -1;
ctx.shadowBlur = 0;
ctx.shadowColor = "rgb(220,220,220)";
ctx.fillStyle = "black";
ctx.translate(250 + Math.cos(angle + arc / 2) * textRadius, 250 + Math.sin(angle + arc / 2) * textRadius);
ctx.rotate(angle + arc / 25 + Math.PI / 25);
var text = restaraunts[i];
ctx.fillText(text, -ctx.measureText(text).width / 2, 0);
ctx.restore();
}

//Arrow
ctx.fillStyle = "black";
ctx.beginPath();
ctx.moveTo(250 - 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius + 5));
ctx.lineTo(250 + 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 + 0, 250 - (outsideRadius - 13));
ctx.lineTo(250 - 9, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius - 5));
ctx.lineTo(250 - 4, 250 - (outsideRadius + 5));
ctx.fill();
}
}

function spin() {
spinAngleStart = Math.random() * 10 + 10;
spinTime = 0;
spinTimeTotal = Math.random() * 3 + 4 * 1000;
rotateWheel();
}

function rotateWheel() {
spinTime += 20;
if (spinTime >= spinTimeTotal) {
stopRotateWheel();
return;
}
var spinAngle = spinAngleStart - easeOut(spinTime, 0, spinAngleStart, spinTimeTotal);
startAngle += (spinAngle * Math.PI / 180);
drawRouletteWheel();
spinTimeout = setTimeout('rotateWheel()', 30);
}

function stopRotateWheel() {
clearTimeout(spinTimeout);
var degrees = startAngle * 180 / Math.PI + 90;
var arcd = arc * 180 / Math.PI;
var index = Math.floor((360 - degrees % 360) / arcd);
ctx.save();
ctx.font = 'bold 30 px Arial';
var text = restaraunts[index]
ctx.fillText(text.replace(/^\s*|\s*$/g, ""), 250 - ctx.measureText(text.replace(/^\s*|\s*$/g, "")).width / 2, 250 + 10);
ctx.restore();
}

function easeOut(t, b, c, d) {
var ts = (t /= d) * t;
var tc = ts * t;
return b + c * (tc + -3 * ts + 3 * t);
}

draw();
</SCRIPT>
<INPUT style="DISPLAY:; FLOAT: right; FONT-SIZE: 40px" onclick=spin(); value=Girar type=button> </TD>
"> </TD></TR></TBODY></TABLE