Skip to content

How to change color of TextSprite? #31

@RylanSchaeffer

Description

@RylanSchaeffer

Whenever I try changing the color of my TextSprite, the code either breaks or the text vanishes. What's the right way to change the color?

Specifically, I have the following sprite:

            reinforcementErrorSprite = new THREE.TextSprite({
                text: percentCorrect + "%",
                alignment: 'left',
                // fontFamily: 'Arial, Helvetica, sans-serif',
                fontSize: 0.51,
                fontStyle: 'bold',
                color: '#ec1b27',
            });

When I try reinforcementErrorSprite.color = '<hex string>', the text vanishes. When I try reinforcementErrorSprite.color = new THREE.Color(<r, g, b>), the text vanishes. What's the right way to set the color?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions