Reputation: 2190
I'm wondering if there is a way to do 2 different fillStyle
's in the same fillText
on canvas.
Example: If I have a string var string = "text";
.
How could i then write that string in different colors with fillText(string, X, Y)
.
Is this even possible?
Upvotes: 1
Views: 63
Reputation: 490607
You would need to split the string into its specific coloured parts, and render each part separately, though position them together to appear as if they were rendered using one fillText()
call.
In order to properly position your multiple text rendering, you can use measureText()
to assist you.
Upvotes: 1