首页 > 解决方案 > Can't add SpriteCanvasMaterial in three.js r94

问题描述

const particleMaterial = new THREE.SpriteCanvasMaterial({
    color: 0x000000,
    program: function(context) {
        context.beginPath();
        context.font = 'bold 20px Arial';
        context.fillStyle = '#058';
        context.transform(-1, 0, 0, 1, 0, 0);
        context.rotate(Math.PI);
        context.fillText(wordFont, 0, 0);
    }
});
const particale = new THREE.Sprite(particleMaterial);
this.scene.add(particale);

The code above cause an error.

I just want to add some canvas shapes to three.js scene.

enter image description here

标签: canvasthree.js

解决方案


推荐阅读