PIXI AnimatedSprite 及打字爆炸动画(5)

效果 : 消除字母 当前位置出现爆炸效果 这里使用到了AnimatedSprite 动画 

Members

An AnimatedSprite is a simple way to display an animation depicted by a list of textures.
let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"];
let textureArray = [];

for (let i=0; i < 4; i++)
{
     let texture = PIXI.Texture.fromImage(alienImages[i]);
     textureArray.push(texture);
};

let mc = new PIXI.AnimatedSprite(textureArray);

mc 对象加载了图片序列。

1、alpha 

      图片透明度(0 - 1)

2、anchor 

   The anchor sets the origin point of the texture. The default is 0,0 this means the texture's origin is the top left Setting the anchor to 0.5,0.5 means the texture's origin is centered Setting the anchor to 1,1 would mean the texture's origin point will be the bottom right corner

3、animationSpeed

    默认值:1

4、buttonMode

   If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive Setting this changes the 'cursor' property to 'pointer'.

const sprite = new PIXI.Sprite(texture); sprite.interactive = true; sprite.buttonMode = true;

5、loop

Whether or not the animate sprite repeats after playing.

Default Value: true

6、onComplete  函数

Function to call when a AnimatedSprite finishes playing

  7、onFrameChange

Function to call when a AnimatedSprite changes which texture is being rendered

8、destroy 

Stops the AnimatedSprite and destroys it

 

9、gotoAndPlay

Goes to a specific frame and begins playing the AnimatedSprite

10、gotoAndStop

Stops the AnimatedSprite and goes to a specific frame

11、play

Plays the AnimatedSprite

12、stop

Stops the AnimatedSprite

更多查看

 

 ----------------------------------------------示例介绍-------------------------------------------------

1、字母下落获取坐标位置

2、字母消除位置,指定爆炸动画,执行完成调用    onComplete  对该动画销毁或隐藏操作。

 

 

转载于:https://www.cnblogs.com/congxueda/p/9349539.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值