@@ -230,24 +230,30 @@ class Font {
230
230
* <div modernizr='webgl'>
231
231
* <code>
232
232
* let geom;
233
- * let fonts ;
233
+ * let activeFont ;
234
234
* let artShader;
235
235
* let lineShader;
236
236
*
237
237
* // Define parameters as simple variables
238
238
* let words = 'HELLO';
239
- * let font = 'Anton';
240
239
* let warp = 1;
241
240
* let extrude = 5;
242
241
* let palette = ["#ffe03d", "#fe4830", "#d33033", "#6d358a", "#1c509e", "#00953c"];
243
242
*
244
243
* async function setup() {
245
244
* createCanvas(200, 200, WEBGL);
246
- * fonts = {
247
- * Anton: await loadFont('https://fonts.gstatic.com/s/anton/v25/1Ptgg87LROyAm0K08i4gS7lu.ttf'),
248
- * Montserrat: await loadFont('https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-Y3tcoqK5.ttf'),
249
- * 'Source Serif': await loadFont('https://fonts.gstatic.com/s/sourceserif4/v8/vEFy2_tTDB4M7-auWDN0ahZJW3IX2ih5nk3AucvUHf6OAVIJmeUDygwjihdqrhxXD-wGvjU.ttf'),
250
- * };
245
+ *
246
+ * // Using Anton as the default font for this example:
247
+ *
248
+ * // Alternative fonts:
249
+ * // Anton: 'https://fonts.gstatic.com/s/anton/v25/1Ptgg87LROyAm0K08i4gS7lu.ttf'
250
+ * // Montserrat: 'https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-Y3tcoqK5.ttf'
251
+ * // Source Serif: 'https://fonts.gstatic.com/s/sourceserif4/v8/vEFy2_tTDB4M7-auWDN0ahZJW3IX2ih5nk3AucvUHf6OAVIJmeUDygwjihdqrhxXD-wGvjU.ttf'
252
+ * activeFont = await loadFont('https://fonts.gstatic.com/s/anton/v25/1Ptgg87LROyAm0K08i4gS7lu.ttf');
253
+ *
254
+ * geom = activeFont.textToModel(words, 0, 50, { sampleFactor: 2, extrude });
255
+ * geom.clearColors();
256
+ * geom.normalize();
251
257
*
252
258
* artShader = baseMaterialShader().modify({
253
259
* uniforms: {
@@ -273,7 +279,7 @@ class Font {
273
279
* return vec4(c, 1.);
274
280
* }`
275
281
* });
276
- *
282
+ *
277
283
* lineShader = baseStrokeShader().modify({
278
284
* uniforms: {
279
285
* 'float time': () => millis(),
@@ -288,12 +294,6 @@ class Font {
288
294
* }
289
295
*
290
296
* function draw() {
291
- * if (geom) freeGeometry(geom);
292
- *
293
- * geom = fonts[font].textToModel(words, 0, 50, { sampleFactor: 2, extrude });
294
- * geom.clearColors();
295
- * geom.normalize();
296
- *
297
297
* background(255);
298
298
* orbitControl();
299
299
* shader(artShader);
0 commit comments