1.x、y

(1)介绍

设置元素的x坐标、y坐标,用于控制元素显示位置

(2)使用方法

  1. var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");
  2. plane.x = 100;//设置水平方向位置
  3. plane.y = 200;//设置垂直方向位置
  4. app.stage.addChild(plane);

2.width、height

(1)介绍

设置元素的宽、高,用于控制元素显示大小

(2)使用方法

  1. var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");
  2. plane.width = 100;//设置宽度
  3. plane.height = 80;//设置高度
  4. app.stage.addChild(plane);

3.rotation

(1)介绍

设置元素旋转的角度

(2)使用方法

var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");    
plane.rotation = 1;//设置旋转的角度为弧度 1
app.stage.addChild(plane);

4、scale

(1)介绍

设置元素缩放比例

(2)使用方法

var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");    
plane.scale.x = 2;//水平方向缩放为原来的2倍    
plane.scale.y = 2; //垂直方向缩放为原来的2倍    
app.stage.addChild(plane);

注意:如果 plane.scale.x 或 plane.scale.y 设置为 -1 时,可实现图片水平或垂直翻转。

5、visible

(1)介绍

设置元素是否可见

(2)使用方法

var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");    
plane.visible = true;    //true或者false
app.stage.addChild(plane);

6、alpha

(1)介绍

设置元素透明度

(2)使用方法

var plane = new PIXI.Sprite.fromImage("res/plane_blue_01.png");    
plane.alpha = 0.5;    
app.stage.addChild(plane);

7、text

(1)介绍

设置文本显示内容

(2)使用方法

var score = new PIXI.Text("得分:10000");    
score.text = “飞机大战真好玩!”;//设置显示内容    
app.stage.addChild(score);

8、style

(1)介绍

设置文本显示样式

(2)使用方法

var score = new PIXI.Text("得分:10000");    
score.style.fill = 0xffffff;//设置字体颜色    
score.style.fontSize = 50;//设置字体大小    
score.style.fontWeight = "bold";//加粗    
score.style.fontStyle = "italic";//斜体    
score.style.fontFamily = "隶书";//设置字体    
app.stage.addChild(score);