vue实现动画旋转,文字不旋转 ,动画的暂停、运行

本文介绍了如何在Vue中实现一个元素的旋转动画,同时确保内部文字保持静止。通过添加类名'a-round'实现旋转效果,而'round-item'类则保证文字不旋转。当鼠标移入时,动画暂停;鼠标移出时,动画恢复运行。内容为基础的Vue动画控制技巧总结。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vue实现动画旋转(类名为a-round),文字不旋转 (类名为round-item)

鼠标移入实现动画的暂停,移出实现动画的运行

本实例为个人总结,转载请标明出处

<template>
  <div>
    <div class="a-content" @mouseenter="mouseEnter" @mouseleave="mouseLeave">
      <div class="a-left">
        <ul class="a-round" :style="{'animation-play-state':animationShow}">
          <li class="round-item" v-for="(item,index) in round" :key="item.id" :style="{top:item.pTop,'animation-play-state':animationShow}"> 
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      animationShow:""
    }
  },
  methods: {
    mouseEnter() {
      this.animationShow="paused"
    },
    mouseLeave() {
      this.animationShow="running"
    }
  }
};
</script>
<style lang="less" scoped>
.a-round {
  transform: rotate3d(0,0,0,0deg);
  animation: access 30s infinite linear;
  @keyframes a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值