找回密码
 立即注册
搜索

css动画不执行

1
回复
375
查看
[复制链接]

1

主题

2

帖子

15

积分

 楼主| 2023-7-10 14:05:23 显示全部楼层 |阅读模式

小米手机是不是不支持动画?

这是官方的demo,在电脑上动画生效,手机上不生效

<template>   <div class="page-wrapper">     <input type="button" class="button" onclick="onCallAnimationClick" value="Animation 动画" />     <text id="animation">{{ mTextState }}</text>   </div></template><script>let $animation = nullexport default {  private: {    mTextState: 'Init'   },   onCallAnimationClick() {    const keyframes = [       {        transform: {          translateX: 0,          translateY: 0         },        time: 0       },       {        transform: {          translateX: '100px',          translateY: '100px'         },        time: 100       }     ]    const options = {      duration: 1000,      easing: 'linear',      delay: 0,      fill: 'none',      iterations: 5     }    const cAnimationNode = this.$element('animation')     $animation = cAnimationNode.animate(keyframes, options)    // 将会延迟至 (delay + startTime) ms 后执行动画;     $animation.startTime = 1000     $animation.play()    this.mTextState = $animation.playState     $animation.oncancel = () => {      this.mTextState = $animation.playState     }     $animation.onfinish = () => {      this.mTextState = $animation.playState     }   } }</script><style>.page-wrapper {  flex-direction: column;  justify-content: center;  align-items: center; }.button {  color: #20a0ff;  background-color: #ffffff;  padding: 10px 20px;  border: 1px solid #20a0ff;  border-radius: 40px; }</style>

回复

使用道具 举报

0

主题

1

帖子

5

积分

2023-7-11 09:59:50 显示全部楼层
使用MIUI的稳定版系统
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册