最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

小程序?qū)崿F(xiàn)文字循環(huán)滾動(dòng)動(dòng)畫

 更新時(shí)間:2021年06月14日 12:02:03   作者:編程改變?nèi)松? 
這篇文章主要為大家詳細(xì)介紹了小程序?qū)崿F(xiàn)文字循環(huán)滾動(dòng)動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文通過(guò)實(shí)例為大家分享了小程序?qū)崿F(xiàn)文字循環(huán)滾動(dòng)的具體代碼,供大家參考,具體內(nèi)容如下

解決問(wèn)題:

1、文字循環(huán)播放特效

2、小程序退出、隱藏后臺(tái)動(dòng)畫停止(已解決)

效果:

代碼:

wxml

<view animation="{{animation}}" class="animation">
  919測(cè)試使用——小程序循環(huán)播放~~~
</view>

wxss

.animation{
  width: 100%;
  transform: translateX(100%);
  position: fixed;
  top: 45%;
  font-size: 16px;
  font-weight: bold;
}

最后js

/**
   * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面初次渲染完成
   */
  onReady: function () {
    this.bindAnimation();
  },
 
  bindAnimation(){
    var this_ = this;
      var animation = wx.createAnimation({
        duration: 5000,
        timingFunction: 'linear',
        transformOrigin:"100% 0 0"
      })
      animation.translateX('-100%').step();
      this.setData({
        animation:animation.export(),
      })
      //設(shè)置循環(huán)動(dòng)畫
      this.animation = animation;
      setInterval(function(){
        //第二個(gè)動(dòng)畫 文字位置初始化
        this.Animation2();
 
        //延遲播放滾動(dòng)動(dòng)畫(效果會(huì)更好點(diǎn))
        setTimeout(function(){
          this.animation.translateX('-100%').step();
          this.setData({
            animation: animation.export(),
          })
        }.bind(this),200);
 
        
      }.bind(this),5000);
 
  },
 
  /**
   * 第二個(gè)動(dòng)畫 文字位置初始化
   */
  Animation2(){
    var this_ = this;
    var animation2 = wx.createAnimation({
      duration: 0,
      timingFunction: 'linear',
      transformOrigin:"100% 0 0"
    })
    animation2.translateX('100%').step();
    this_.setData({
      animation:animation2.export(),
    })
  },
 
  /**
   * 解決小程序退出、隱藏后臺(tái)動(dòng)畫停止
   */
  onHide: function () {
    //解決小程序退出、隱藏后臺(tái)動(dòng)畫停止
    //重新觸發(fā)動(dòng)畫方法即可
    this.bindAnimation();
},

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

新津县| 磐石市| 房产| 肥西县| 砚山县| 巢湖市| 濮阳市| 周口市| 鹤峰县| 嘉鱼县| 许昌市| 长丰县| 肃南| 贡嘎县| 辰溪县| 乐平市| 新巴尔虎左旗| 瑞安市| 三门县| 花莲县| 资兴市| 金寨县| 环江| 榆林市| 三穗县| 松潘县| 冷水江市| 靖宇县| 汶川县| 南宫市| 阳江市| 广宗县| 湖南省| 延川县| 临邑县| 镇巴县| 邻水| 北辰区| 兴化市| 自贡市| 花莲市|