-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learn Three.js - Fourth Edition
By :
In this section, we’ll look at the following two ways of changing what the sprite looks like:
Let’s start by drawing the image ourselves.
In the attributes for THREE.PointsMaterial, we mentioned the map property. With the map property, we can load a texture for the individual points. With Three.js, this texture can also be the output from an HTML5 canvas. Before we look at the code, let’s look at an example (canvastexture.js):
Figure 7.4 – Creating sprites using a canvas-based texture
Here, you can see that we’ve got a large set of Pac-Man-like ghosts on the screen. This uses the same approach that we saw in the Understanding points and sprites section earlier. This time, though, we aren’t showing...