Text#addStrokeColor()

addStrokeColor(color, position) → {Phaser.Text}

Set specific stroke colors for certain characters within the Text.

It works by taking a color value, which is a typical HTML string such as #ff0000 or rgb(255,0,0) and a position.
The position value is the index of the character in the Text string to start applying this color to.
Once set the color remains in use until either another color or the end of the string is encountered.
For example if the Text was Photon Storm and you did Text.addColor('#ffff00', 6) it would color in the word Storm in yellow.

This has no effect if stroke is disabled or has a thickness of 0.

If you wish to change the text fill color see addColor instead.

Parameters
Name Type Description
color string

A canvas fillstyle that will be used on the text stroke eg red, #00FF00, rgba().

position number

The index of the character in the string to start applying this color value from.

Returns

This Text instance.

Source code: gameobjects/Text.js (Line 853)
doc_phaser
2017-02-14 11:13:25
Comments
Leave a Comment

Please login to continue.