
Learning Three.js: The JavaScript 3D Library for WebGL - Second Edition
By :

Three.js offers three different ways you can use an HTML5 canvas to style your particles. If you use THREE.CanvasRenderer
, you can directly reference an HTML5 canvas from THREE.SpriteCanvasMaterial
. When you use THREE.WebGLRenderer
, you need to take a couple of extra steps to use an HTML5 canvas to style your particles. In the following two sections, we'll show you the different approaches.
With
THREE.SpriteCanvasMaterial
, you can use the output from an HTML5 canvas as a texture for your particles. This material is specifically created for THREE.CanvasRenderer
and only works when you use this specific renderer. Before we look at how to use this material, let's first look at the attributes you can set on this material:
Name |
Description |
---|---|
|
This is the color of the particle. Depending on the specified |
|
This is a function that takes... |
Change the font size
Change margin width
Change background colour