animation-play-state在ios中的问题
发布于 6 年前 作者 jun92 8553 次浏览 来自 问答

animation-play-state在ios中失效无法解决,又不能直接操作wxml,怎么解决?

4 回复

index.js

//index.js

Page({

  data: {

    playing:false

  },

  bingclick: function (e) {

    if (this.data.playing) {

      this.setData({ playing: false })

    } else {

      this.setData({ playing: true })

    }

  }

})

index.wxml

<!–index.wxml–>

<view class=“container”>

  <label>点击红色正方形(旋转/暂停)</label>

  <view class=“kuang” style=“animation-play-state:{{playing?‘running’:‘paused’}} !important” bindtap=“bingclick”></view>

</view>

index.wxss

/**index.wxss**/

@keyframes circle{0%{transform: rotate(0deg)}100%{ transform: rotate(360deg)}}

.kuang{

  margin: 160rpx auto 0;

  position: relative;

  z-index: 10;

  width: 400rpx;

  height: 400rpx;

  -webkit-animation: circle 20s linear infinite;

  -moz-animation: circle 20s linear infinite;

  animation: circle 20s linear infinite;

  background-color: red;

}

旋转(播放暂停会出现卡顿BUG,安卓跟微信开发工具没有出现)

怀疑是iOS本身的问题。建议测试一下iOS下普通网页是否有相同问题。

请详细描述问题,并提供可复现问题的代码示例。

回到顶部