O'Reilly logo

Learning Three.js: The JavaScript 3D Library for WebGL by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the materials for a line geometry

The last couple of materials that we're going to look at can only be used on one specific geometry: the THREE.Line. As the name implies this is a single line that only consists of vertices and doesn't contain any faces. The Three.js library provides two different materials that you can use on a line, as follows:

  • LineBasicMaterial: The basic material for a line that allows you to set the colors, line width, line cap, and line join properties
  • LineDashedMaterial: Has the same properties as the LineBasicMaterial, but allows you to create a dashed effect by specifying the dash and spacing sizes

We'll start with the basic variant, and after that we'll look at the dashed variant.

The LineBasicMaterial

The materials ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required