textSketch = () => {
  return ({ context, width, height, settings }) => {
    const { text } = settings;

    // Clear canvas
    context.clearRect(0, 0, width, height);

    // Draw background
    context.fillStyle = 'black';
    context.fillRect(0, 0, width, height);

    // Draw text
    const fontSize = 80;
    context.fillStyle = 'white';
    context.textAlign = 'center';
    context.textBaseline = 'middle';
    context.font = `${fontSize}px monospace`;
    context.fillText(text || '', width / 2, height / 2);
  };
}
A WebGL example of a basic rotating cube with text, using ThreeJS.

This is similar to canvas-in-canvas.js example, in that it uses
a second sketch to hold the canvas. You may or may not consider
this to be overkill, depending on your application...

@author Matt DesLauriers (@mattdesl)