Skip to content

Commit c99d982

Browse files
committed
Update learn/curves files for i18n.
1 parent 919e482 commit c99d982

File tree

2 files changed

+78
-42
lines changed

2 files changed

+78
-42
lines changed

src/data/en.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,56 @@ learn:
12091209
Now let's look at what some code with shapes in more complete form, with
12101210
canvas dimensions of 200 by 200. Note the use of the createCanvas() function
12111211
to specify the width and height of the canvas.
1212+
curves-description1: 'This tutorial is written by J David Eisenberg and ported by Sally Chen. If you see any errors or have comments, '
1213+
curves-description2: ' please let us know.'
1214+
curves-description3: 'This work is licensed under a '
1215+
curves-description4: ' Creative Commons Attribution-NonCommercial-ShareAlinke 4.0 International License.'
1216+
curves-p1x1: 'This short tutorial introduces you to the three types of curves in p5.js: arcs, spline curves, and Bézier curves.'
1217+
curves-arcs-title: ' Arcs '
1218+
curves-arcs-p1x1: 'Arcs are the simplest curves to draw, it is defined an arc as a section of an ellipse. You call the function with these parameters:'
1219+
curves-arcs-p2x1: 'arc (x, y, w, h, start, stop, [mode])'
1220+
curves-arcs-p3x1: >-
1221+
The first four parameters (x,y,w,h) define the boundary box for your arc and the next two (start, stop), are the start and stop angles for the arc. These angles are given in radians
1222+
and are measured clockwise with zero degrees pointing east and PI radians equals 180°.
1223+
curves-spline-curves-title: 'Spline Curves'
1224+
curves-spline-curves-p1x1: >-
1225+
Arcs are fine, but they’re plain. The next function, curve(), lets you draw curves that aren’t necessarily part of an arc. This function draws what is technically called a Rom-Catmull Spline.
1226+
To draw the curve, you must specify the (x, y) coordinates of the points where the curve starts and ends. You must also specify two control points which determine the direction and amount of curvature.
1227+
The first two and last two parameters are the control points of the curve.
1228+
A call to curve() uses these parameters:
1229+
curves-spline-curves-p2x1: 'curve (cpx1, cpy1, x1, y1, x2, y2, cpx2, cpy2);'
1230+
curves-spline-curves-p3x1: 'How do the control points affect the way the curve looks?'
1231+
curves-spline-curves-p4x1: 'The tangent to the curve at the start point is parallel to the line between control point one and the end of the curve. The tangent to the curve at the end point is parallel to the line between the start point and control point 2.'
1232+
curves-spline-curves-p5x1: 'The following diagram shows a curve and the points can be dragged to show how the control point affects the curve:'
1233+
curves-continuous-spline-curves-title: 'Continuous Spline Curves'
1234+
curves-continuous-spline-curves-p1x1: >-
1235+
In isolation, a single curve() is not particularly appealing. To draw a continuous curve through several points, you are better off using the curveVertex() function.
1236+
You can only use this function when you are creating a shape with the beginShape() and endShape() functions.In common usage, people use the first point of the curve
1237+
as the first control point and the last point of the curve as the last control point.
1238+
curves-bezier-curves-title: 'Bézier Curves'
1239+
curves-bezier-curves-p1x1: >-
1240+
Though better than arcs, spline curves don’t seem to have those graceful, swooping curves that say “art.” For those, you need to draw Bézier curves with the bezier() function.
1241+
As with spline curves, the bezier() function has eight parameters, but the order is different. The first two and last two parameters are the start and end points while middle
1242+
four points are the control points.
1243+
curves-bezier-curves-p2x1: ' bezier(x1, y1, cpx1, cpy1, cpx2, cpy2, x2, y2); '
1244+
curves-bezier-curves-p3x1: >-
1245+
While it is difficult to visualize how the control points affect a curve(), it is slightly easier to see how the control points affect Bézier curves.
1246+
Imagine two poles and several rubber bands. The poles connect the control points to the endpoints of the curve. A rubber band connects the tops of the poles.
1247+
Two more rubber bands connect the midpoints of the poles to the midpoint of the first rubber band. One more rubber band connects their midpoints.
1248+
The center of that last rubber band is tied to the curve. This diagram helps to explain, the points can be moved to change the curve.
1249+
curves-continuous-bezier-curves-title: ' Continuous Bézier Curves'
1250+
curves-continuous-bezier-curves-p1x1: >-
1251+
Just as curveVertex() allows you to make continuous spline curves, bezierVertex() lets you make continuous Bézier curves.
1252+
Again, you must be within a beginShape() / endShape() sequence. You must use vertex(startX, startY) to specify the starting anchor point of the curve.
1253+
Subsequent points are specified with a call to:
1254+
curves-continuous-bezier-curves-p2x1: 'bezierVertex(cpx1, cpy1, cpx2, cpy2, x, y);'
1255+
curves-continuous-bezier-curves-p3x1: >-
1256+
Here is a continuous Bézier curve, but it doesn’t join smoothly. In order to make two curves A and B smoothly continuous, the last control point of A,
1257+
the last point of A, and the first control point of B have to be on a straight line.
1258+
curves-summary-title: 'Summary'
1259+
curves-summary-li1: 'Use arc() when you need a segment of a circle or an ellipse. You can’t make continuous arcs or use them as part of a shape.'
1260+
curves-summary-li2: 'Use curve() when you need a small curve between two points. Use curveVertex() to make a continuous series of curves as part of a shape.'
1261+
curves-summary-li3: 'Use bezier() when you need long, smooth curves. Use bezierVertex() to make a continuous series of Bézier curves as part of a shape.'
12121262
teach-desc: 'Teach a p5 workshop or class, or create teaching materials!'
12131263
libraries:
12141264
Libraries: Libraries

src/templates/pages/learn/curves.hbs

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,29 @@ slug: learn/
1212
<main >
1313

1414
<div class="attribution">
15-
This tutorial is written by J David Eisenberg and ported by Sally Chen. If you see any errors or have comments, <a href="https://github.com/processing/p5.js/issues"> please let us know.</a>
16-
This work is licensed under a <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"> Creative Commons Attribution-NonCommercial-ShareAlinke 4.0 International License.</a>
15+
{{#i18n "curves-description1"}}{{/i18n}}<a href="https://github.com/processing/p5.js/issues">{{#i18n "curves-description2"}}{{/i18n}}</a>
16+
{{#i18n "curves-description3"}}{{/i18n}}<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">{{#i18n "curves-description4"}}{{/i18n}}</a>
1717

1818
</div>
1919

20-
<h1>Curves</h1>
20+
<h1>{{#i18n "curves-title"}}{{/i18n}}</h1>
2121

2222
<p>
23-
This short tutorial introduces you to the three types of curves in p5.js: arcs, spline curves, and Bézier curves.
23+
{{#i18n "curves-p1x1"}}{{/i18n}}
2424
</p>
2525

26-
<h2> Arcs </h2>
26+
<h2>{{#i18n "curves-arcs-title"}}{{/i18n}}</h2>
2727

2828
<p>
29-
Arcs are the simplest curves to draw, it is defined an arc as a section of an ellipse. You call the function with these parameters:
29+
{{#i18n "curves-arcs-p1x1"}}{{/i18n}}
3030
</p>
3131

3232
<p>
33-
arc (x, y, w, h, start, stop, [mode])
33+
{{#i18n "curves-arcs-p2x1"}}{{/i18n}}
3434
</p>
3535

3636
<p>
37-
The first four parameters (x,y,w,h) define the boundary box for your arc and the next two (start, stop), are the start and stop angles for the arc. These angles are given in radians
38-
and are measured clockwise with zero degrees pointing east and PI radians equals 180°.
37+
{{#i18n "curves-arcs-p3x1"}}{{/i18n}}
3938
</p>
4039

4140
<!-- this script only needs to get added once even if there are multiple widget instances -->
@@ -53,42 +52,37 @@ slug: learn/
5352
}
5453
</script>
5554

56-
<h2>Spline Curves</h2>
55+
<h2>{{#i18n "curves-spline-curves-title"}}{{/i18n}}</h2>
5756

5857
<p>
59-
Arcs are fine, but they’re plain. The next function, curve(), lets you draw curves that aren’t necessarily part of an arc. This function draws what is technically called a Rom-Catmull Spline.
60-
To draw the curve, you must specify the (x, y) coordinates of the points where the curve starts and ends. You must also specify two control points which determine the direction and amount of curvature.
61-
The first two and last two parameters are the control points of the curve.
62-
A call to curve() uses these parameters:
58+
{{#i18n "curves-spline-curves-p1x1"}}{{/i18n}}
6359
</p>
6460

6561
<p>
66-
curve (cpx1, cpy1, x1, y1, x2, y2, cpx2, cpy2);
62+
{{#i18n "curves-spline-curves-p2x1"}}{{/i18n}}
6763
</p>
6864

6965
<p>
70-
How do the control points affect the way the curve looks?
66+
{{#i18n "curves-spline-curves-p3x1"}}{{/i18n}}
7167
</p>
7268

7369
<p>
74-
The tangent to the curve at the start point is parallel to the line between control point one and the end of the curve. The tangent to the curve at the end point is parallel to the line between the start point and control point 2.
70+
{{#i18n "curves-spline-curves-p4x1"}}{{/i18n}}
7571
</p>
7672

7773
<p>
78-
The following diagram shows a curve and the points can be dragged to show how the control point affects the curve:
74+
{{#i18n "curves-spline-curves-p5x1"}}{{/i18n}}
7975
</p>
8076

8177
<!-- iframe for the curve and dragging points -->
8278
<iframe src="{{assets}}/learn/curves/curve_ex/embed.html" width="350" height="350">
8379
</iframe>
8480

8581

86-
<h2>Continuous Spline Curves</h2>
82+
<h2>{{#i18n "curves-continuous-spline-curves-title"}}{{/i18n}}</h2>
8783

8884
<p>
89-
In isolation, a single curve() is not particularly appealing. To draw a continuous curve through several points, you are better off using the curveVertex() function.
90-
You can only use this function when you are creating a shape with the beginShape() and endShape() functions.In common usage, people use the first point of the curve
91-
as the first control point and the last point of the curve as the last control point.
85+
{{#i18n "curves-continuous-spline-curves-p1x1"}}{{/i18n}}
9286
</p>
9387

9488

@@ -119,43 +113,35 @@ slug: learn/
119113
}
120114
</script>
121115

122-
<h2>Bézier Curves</h2>
116+
<h2>{{#i18n "curves-bezier-curves-title"}}{{/i18n}}</h2>
123117

124118
<p>
125-
Though better than arcs, spline curves don’t seem to have those graceful, swooping curves that say “art.” For those, you need to draw Bézier curves with the bezier() function.
126-
As with spline curves, the bezier() function has eight parameters, but the order is different. The first two and last two parameters are the start and end points while middle
127-
four points are the control points.
119+
{{#i18n "curves-bezier-curves-p1x1"}}{{/i18n}}
128120
</p>
129121

130-
<p> bezier(x1, y1, cpx1, cpy1, cpx2, cpy2, x2, y2); </p>
122+
<p>{{#i18n "curves-bezier-curves-p2x1"}}{{/i18n}}</p>
131123

132124
<!-- iframe of Bezier example -->
133125
<iframe src="{{assets}}/learn/curves/bezier/embed.html" width="400" height="400">
134126
</iframe>
135127

136128
<p>
137-
While it is difficult to visualize how the control points affect a curve(), it is slightly easier to see how the control points affect Bézier curves.
138-
Imagine two poles and several rubber bands. The poles connect the control points to the endpoints of the curve. A rubber band connects the tops of the poles.
139-
Two more rubber bands connect the midpoints of the poles to the midpoint of the first rubber band. One more rubber band connects their midpoints.
140-
The center of that last rubber band is tied to the curve. This diagram helps to explain, the points can be moved to change the curve.
129+
{{#i18n "curves-bezier-curves-p3x1"}}{{/i18n}}
141130
</p>
142131

143132
<!-- image of bezier with lines -->
144133
<img src="{{assets}}/learn/curves/bezier_with_lines/bezier_with_lines.png" style="width:150px;">
145134

146-
<h2> Continuous Bézier Curves</h2>
135+
<h2>{{#i18n "curves-continuous-bezier-curves-title"}}{{/i18n}}</h2>
147136

148137
<p>
149-
Just as curveVertex() allows you to make continuous spline curves, bezierVertex() lets you make continuous Bézier curves.
150-
Again, you must be within a beginShape() / endShape() sequence. You must use vertex(startX, startY) to specify the starting anchor point of the curve.
151-
Subsequent points are specified with a call to:
138+
{{#i18n "curves-continuous-bezier-curves-p1x1"}}{{/i18n}}
152139
</P>
153140

154-
<p>bezierVertex(cpx1, cpy1, cpx2, cpy2, x, y);</P>
141+
<p>{{#i18n "curves-continuous-bezier-curves-p2x1"}}{{/i18n}}</P>
155142

156143
<p>
157-
Here is a continuous Bézier curve, but it doesn’t join smoothly. In order to make two curves A and B smoothly continuous, the last control point of A,
158-
the last point of A, and the first control point of B have to be on a straight line.
144+
{{#i18n "curves-continuous-bezier-curves-p3x1"}}{{/i18n}}
159145
</P>
160146

161147
<script type="text/p5" data-autoplay data-p5-version="{{ version }}">
@@ -180,12 +166,12 @@ slug: learn/
180166
}
181167
</script>
182168

183-
<h2>Summary</h2>
169+
<h2>{{#i18n "curves-summary-title"}}{{/i18n}}</h2>
184170
<p>
185171
<ul class="list_view">
186-
<li>Use arc() when you need a segment of a circle or an ellipse. You can’t make continuous arcs or use them as part of a shape.</li>
187-
<li>Use curve() when you need a small curve between two points. Use curveVertex() to make a continuous series of curves as part of a shape.</li>
188-
<li>Use bezier() when you need long, smooth curves. Use bezierVertex() to make a continuous series of Bézier curves as part of a shape.</li>
172+
<li>{{#i18n "curves-summary-li1"}}{{/i18n}}</li>
173+
<li>{{#i18n "curves-summary-li2"}}{{/i18n}}</li>
174+
<li>{{#i18n "curves-summary-li3"}}{{/i18n}}</li>
189175
</ul>
190176
</p>
191177

0 commit comments

Comments
 (0)