After updating Three.js from v73 to v81, I encountered the following error:
Uncaught TypeError: path.toShapes is not a function
Upon reviewing the new release notes, I discovered the following changes made to Path:
- The removal of .actions (yay)
- Moving getPoints() to CurvePath
- Moving toShapes() to a new class ShapePath
The code segment causing the issue looks like this:
var shapes = [];
for (var i = 0; i < paths.length; ++i) {
// Turning each SVG path into a three.js shape
var path = d3.transformSVGPath( paths[i] );
// There might have been an issue with the winding order.
**var newShapes = path.toShapes(effectController.reverseWO);**
// Adding these three.js shapes to an array.
shapes = shapes.concat(newShapes);
}
I searched for THREE.Path but couldn't find it, so I tried importing Path.js in hopes of resolving the problem, but with no success. As a newcomer to Three.js, I'm unsure if this is a basic question, but after spending a day on it, I'm still unable to resolve it.