Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var width = 100, height = 100;
- canvas.width = width + 10;
- canvas.height = height + 10;
- var container = new c.Container();
- container.x = 10;
- container.y = 10;
- container.setBounds(0, 0, width, height);
- var rect = new c.Shape();
- rect.graphics.beginFill('#6e7e8e').drawRect(0, 0, width, height);
- container.addChild(rect);
- var text = new c.Text();
- text.set({
- text: 'hello',
- textAlign: 'center'
- });
- container.addChild(text);
- stage.addChild(container);
- stage.update();
- text.set({
- text: 'hello',
- });
- var b = text.getBounds();
- text.x = (width/2) - (b.width/2);
- text.y = (height/2) - (b.height/2);
Add Comment
Please, Sign In to add comment