@@ -1203,47 +1203,48 @@ tecnologías de ((gráficos)) dado que no necesitamos dibujar texto,
12031203manejar interacciones del mouse o trabajar con un numero de elementos
12041204extraordinariamente grande.
12051205
1206- ## Summary
1206+ ## Resumen
12071207
1208- In this chapter we discussed techniques for drawing graphics in the
1209- browser, focusing on the ` <canvas> ` element .
1208+ En este capítulo discutimos técnicas para dibujo de gráficos en el
1209+ navegador, enfoncándonos en el elemento ` <canvas> ` .
12101210
1211- A canvas node represents an area in a document that our program may
1212- draw on. This drawing is done through a drawing context object,
1213- created with the ` getContext ` method .
1211+ Un nodo de canvas representa un área en un documento en el que nuestro
1212+ programa puede dibujar. Este dibujo se hace a través de objetos de
1213+ contexto de dibujo, usando el método ` getContext ` .
12141214
1215- The 2D drawing interface allows us to fill and stroke various shapes .
1216- The context's ` fillStyle ` property determines how shapes are filled .
1217- The ` strokeStyle ` and ` lineWidth ` properties control the way lines are
1218- drawn .
1215+ La interfaz de dibujo 2D nos permite rellenar y delineas varias figuras .
1216+ La propiedad ` fillStyle ` del contexto determina como las figuras son rellenadas .
1217+ Las propiedades ` strokeStyle ` y ` lineWidth ` controlan la manera en
1218+ que las líneas se dibujan .
12191219
1220- Rectangles and pieces of text can be drawn with a single method call .
1221- The ` fillRect ` and ` strokeRect ` methods draw rectangles, and the
1222- ` fillText ` and ` strokeText ` methods draw text. To create custom
1223- shapes, we must first build up a path .
1220+ Los rectángulos y textos se pueden dibujar con una simple llamada de método .
1221+ Los métodos ` fillRect ` y ` strokeRect ` dibujan rectángulos y los
1222+ métodos ` fillText ` y ` strokeText ` dibujan texto. Para crear
1223+ figuras a medida, primero debemos crear una ruta .
12241224
12251225{{index stroking, filling}}
12261226
1227- Calling ` beginPath ` starts a new path. A number of other methods add
1228- lines and curves to the current path. For example, ` lineTo ` can add a
1229- straight line. When a path is finished, it can be filled with the
1230- ` fill ` method or stroked with the ` stroke ` method.
1231-
1232- Moving pixels from an image or another canvas onto our canvas is done
1233- with the ` drawImage ` method. By default, this method draws the whole
1234- source image, but by giving it more parameters, you can copy a
1235- specific area of the image. We used this for our game by copying
1236- individual poses of the game character out of an image that contained
1237- many such poses.
1238-
1239- Transformations allow you to draw a shape in multiple orientations. A
1240- 2D drawing context has a current transformation that can be changed
1241- with the ` translate ` , ` scale ` , and ` rotate ` methods. These will affect
1242- all subsequent drawing operations. A transformation state can be saved
1243- with the ` save ` method and restored with the ` restore ` method.
1244-
1245- When showing an animation on a canvas, the ` clearRect ` method can be
1246- used to clear part of the canvas before redrawing it.
1227+ Llamar a ` beginPath ` empieza una nueva ruta. Otra serie de métodos
1228+ agregan líneas y curvas a la ruta actual. Por ejemplo ` lineTo `
1229+ puede dibujar una línea reacta. Cuando la ruta de termina, puede
1230+ rellenarse con el método ` fill ` o delinearse con el método ` stroke ` .
1231+
1232+ Mover pixeles desde una imagen o desde un canvas a otro puede hacerse
1233+ con el método ` drawImage ` . Por defecto, este método dibuja la imagen
1234+ fuente completa, pero dándole parámetros, puedes copiar un área
1235+ específica de la imagen. La usamos para nuestro juego copiando poses
1236+ individuales del personajes salidas de una imagen que contiene
1237+ muchas poses.
1238+
1239+ Las transformaciones te permiten dibujar una figura en múltiples orientaciones
1240+ un contexto de dibujo 2D tiene transformaciones que se pueden usar
1241+ con los métodos ` translate ` , ` scale ` y ` rotate ` . Estos afectarán
1242+ todas las operaciones de dibujo subsecuentes. El estado de una
1243+ transformación se puede guardar con el método ` save ` y restaurar
1244+ con el método ` restore ` .
1245+
1246+ Cuando se muestra una animación en un canvas, el método ` clearRect `
1247+ puede usarse para limpiar parte del canvas antes de redibujarlo.
12471248
12481249## Exercises
12491250
0 commit comments