zoukankan      html  css  js  c++  java
  • 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  对该动画销毁或隐藏操作。

     

  • 相关阅读:
    UIView与CALayer的区别,很详细
    iOS开发之启动动画(动态欢迎界面,非静态Default)
    js前端验证时间大小
    C#联通新版验证码识别的实现
    C#打印100以内质数
    SQL竖表转横表 / 横表转竖表
    不用中间变量交换两个变量的值
    单例模式
    C#递归遍历指定目录下文件和文件夹
    冒泡排序
  • 原文地址:https://www.cnblogs.com/congxueda/p/9349539.html
Copyright © 2011-2022 走看看