Ver Mensaje Individual
  #21 (permalink)  
Antiguo 23/05/2014, 13:33
Avatar de Carlangueitor
Carlangueitor
Moderador ლ(ಠ益ಠლ)
 
Fecha de Ingreso: marzo-2008
Ubicación: México
Mensajes: 10.037
Antigüedad: 16 años, 2 meses
Puntos: 1329
Respuesta: Canvas y 'animaciones'

Revisé el primer archivo JS (que no es lo que te genera problemas, pero si así haces todo tienes problemas), es malo:

Código Javascript:
Ver original
  1. document.getElementById('TestNombre').style.width = (950*this.ProportionResolutionX) + 'px';
  2. document.getElementById('TestNombre').style.height = (40*this.ProportionResolutionY) + 'px';
  3. document.getElementById('TestNombre').style.marginTop = (100*this.ProportionResolutionX) + 'px';
  4. document.getElementById('TestNombre').style.marginLeft = (15*this.ProportionResolutionY) + 'px';
  5. document.getElementById('TestNombre').style.width = (950*this.ProportionResolutionX) + 'px';
  6. document.getElementById('TestNombre').style.height = (40*this.ProportionResolutionY) + 'px';
  7. document.getElementById('TestNombre').style.marginTop = (100*this.ProportionResolutionX) + 'px';
  8. document.getElementById('TestNombre').style.marginLeft = (15*this.ProportionResolutionY) + 'px';
  9. document.getElementById('TestNombre').style.fontSize = (22*this.ProportionResolutionY) + 'px';

Haces la busqueda en el DOM 8 veces, fuera de que sea una mala práctica por el código duplicado eso carga demasiado, deberías hacer algo así:

Código Javascript:
Ver original
  1. var testNombre = document.getElementById('TestNombre');
Y trabajar con ese objeto.

Luego eso es lo que pasa, por cada punto, cada vez que se mueve haces el lookup:

Código Javascript:
Ver original
  1. document.getElementById('Point'+this.ID).style.webkitTransform = 'translate('+this.CoordinateX+'px,'+this.CoordinateY+'px)';
Cachea el elemento y llamalo cuando lo necesites.

Saludos
__________________
Grupo Telegram Docker en Español