@@ -1483,42 +1483,44 @@ Después de encontrar la nueva posición y velocidad del balón, usa
14831483
14841484hint}}
14851485
1486- ### Precomputed mirroring
1486+ ### Reflejo precalculado
14871487
14881488{{index optimization, "bitmap graphics", mirror}}
14891489
1490- One unfortunate thing about ((transformation))s is that they slow down
1491- the drawing of bitmaps. The position and size of each ((pixel)) has to be
1492- transformed, and though it is possible that ((browser))s will get
1493- cleverer about transformation in the ((future)), they currently cause a
1494- measurable increase in the time it takes to draw a bitmap.
1490+ Una cosa desafortunada sobre la ((transformacion))es que ralentizan
1491+ el dibujado de mapa de bits. La posición y tamaño de cada ((pixel))
1492+ tiene que ser transformada e incluso es posible que los ((navegador))es
1493+ estén listos para la transformación en el ((futuro)), actualmente
1494+ causa un incremento considerable en el tiempo que toma dibujar un
1495+ mapa de bits.
14951496
1496- In a game like ours, where we are drawing only a single transformed
1497- sprite, this is a nonissue. But imagine that we need to draw hundreds
1498- of characters or thousands of rotating particles from an explosion .
1497+ En un juego como el nuestro, donde dibujamos un simple sprite transformado
1498+ que no es un gran problema. Pero imagina que necesitamos dibujar
1499+ cientos de personajes o miles de partículas rotatorias de una explosión .
14991500
1500- Think of a way to allow us to draw an inverted character without
1501- loading additional image files and without having to make transformed
1502- ` drawImage ` calls every frame.
1501+ Piensa en una forma de permitirnos dibujar personajes sin cargar
1502+ imágenes adiciones y sin tener que transformar las llamadas de
1503+ ` drawImage ` cada frame.
15031504
15041505{{hint
15051506
15061507{{index mirror, scaling, "drawImage method"}}
15071508
1508- The key to the solution is the fact that we can use a ((canvas))
1509- element as a source image when using ` drawImage ` . It is possible to
1510- create an extra ` <canvas> ` element, without adding it to the document ,
1511- and draw our inverted sprites to it, once. When drawing an actual
1512- frame, we just copy the already inverted sprites to the main canvas.
1509+ La clave de la solución es el hecho de que podemos hacer uso de un elemento
1510+ ((canvas)) como fuente de la image cuando usemos ` drawImage ` . Es
1511+ posible crear un elemento ` <canvas> ` , sin agregarlos al documento ,
1512+ y dibujar nuestros sprites invertidos en ello. Cuando dibujamos un
1513+ frame, en realidad solo copiamos los sprites invertidos al canvas principal .
15131514
15141515{{index "load event"}}
15151516
1516- Some care would be required because images do not load instantly. We
1517- do the inverted drawing only once, and if we do it before the image
1518- loads, it won't draw anything. A ` "load" ` handler on the image can be
1519- used to draw the inverted images to the extra canvas. This canvas can
1520- be used as a drawing source immediately (it'll simply be blank until
1521- we draw the character onto it).
1517+ Podríamos necesitar algunas precauciones para evitar que las imágenes
1518+ se carguen de forma instantánea. Hacemos el dibujo invertido una
1519+ sola vez, y si lo hacemos antes de que cargue la imagen, no dibujará nada.
1520+ Un handler ` "load" ` en la imagen puede usarse para dibujar imágenes
1521+ invertidas al canvas extra. Este canvas puede ser usado como una
1522+ imagen fuente (solo aparecerá en blanco hasta que dibujemos un
1523+ personaje en él).
15221524
15231525hint}}
15241526
0 commit comments