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  对该动画销毁或隐藏操作。

     

  • 相关阅读:
    布局类组件介绍
    容器类组件介绍
    应用升级介绍
    Http组件的介绍
    Webview组件和HTML的介绍
    数据绑定介绍
    业界最具影响力MySQL精品文章荟萃(300篇)
    业界最有价值的 ASP.NET 博文汇总
    一个引号导致1个小时网站打不开
    这个世界从来没有任何一件工作叫“钱多、事少、离家近”
  • 原文地址:https://www.cnblogs.com/congxueda/p/9349539.html
Copyright © 2011-2022 走看看