Created
March 5, 2020 14:07
-
-
Save vojto/14818a121b11bcc21f9f7ff6f0aa8dd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Text } from 'pixi.js'; | |
import { PixiComponent } from '@inlet/react-pixi'; | |
const FastText = PixiComponent('FastText', { | |
create: props => new Text(props.text), | |
applyProps: (instance, oldProps, props) => { | |
const { x, y, text } = props; | |
if (x !== oldProps.x || y !== oldProps.y) { | |
instance.x = x; | |
instance.y = y; | |
} | |
if (text !== oldProps.text) { | |
instance.text = text; | |
} | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment