其他分享
首页 > 其他分享> > Vue 过渡动画

Vue 过渡动画

作者:互联网

1.在元素外层套上transition标签

<div class="head">
      <transition name="sun_move" appear>
        <img src="../assets/image/img_sun.png" />
      </transition>
</div>

2.css样式

<style>
/*元素出现时 进行的动画*/
.sun_move-enter-active {
  animation: move 3s linear;
}
/*元素隐藏时进行的动画*/
.sun_move-leave-active {
  animation: move 3s linear reserve;
}
@keyframes move {
  from {
    transform: translate(-350px, 50px);
  }
  to {
    transform: translateX(0px);
  }
}
</style>

标签:动画,Vue,linear,3s,move,transform,animation,过渡
来源: https://blog.csdn.net/as_64/article/details/122848269