手搓动态流水线

效果图如下  截图动不了其实是能动的 和箭头指向一致的动画有 里面的icon也是可以更换的

使用

<template>
  <div class="toptop" :style="getstyle(1)">
    <div class="linecon" :class="direction">
      <div class="keyinner" v-for="item in count" :key="item">
        <i class="el-icon-caret-left" v-if="direction == 'left'" />
        <i class="el-icon-caret-right" v-if="direction == 'right'" />
        <i class="el-icon-caret-top" v-if="direction == 'top'" />
        <i class="el-icon-caret-bottom" v-if="direction == 'bottom'" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["count", "direction", "color"],
  methods: {
    getstyle() {
      if (this.direction == "right") {
        return {
          width: this.count * 20 + "px",
          height: "20px",
          backgroundColor: this.color ? this.color : "gray",
        };
      } else if (this.direction == "left") {
        return {
          width: this.count * 20 + "px",
          height: "20px",
          backgroundColor: this.color ? this.color : "gray",
        };
      } else if (this.direction == "top") {
        return {
          height: this.count * 20 + "px",
          width: "20px",
          backgroundColor: this.color ? this.color : "gray",
        };
      } else if (this.direction == "bottom") {
        return {
          height: this.count * 20 + "px",
          width: "20px",
          backgroundColor: this.color ? this.color : "gray",
        };
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.toptop {
  overflow: hidden;
  background-color: gray;
  margin-bottom: 10px;
}
.linecon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  flex-wrap: wrap;
  will-change: transform;

  .keyinner {
    width: auto;
    height: 20px;
    font-size: 20px;
    color: #fff;
  }
}
.linecon.left {
  animation: scaleAnimationleft 0.2s ease-in-out infinite;
}
.linecon.top {
  display: block;
  animation: scaleAnimationtop 0.2s ease-in-out infinite;
}
.linecon.right {
  animation: scaleAnimationright 0.2s ease-in-out infinite;
}
.linecon.bottom {
  animation: scaleAnimationbottom 0.2s ease-in-out infinite;
}
@keyframes scaleAnimationleft {
  0% {
    transform: translateX(20px);
  }
  50% {
    transform: translateX(10px);
  }
  100% {
    transform: translateX(0px);
  }
}
@keyframes scaleAnimationright {
  0% {
    transform: translateX(-20px);
  }
  50% {
    transform: translateX(-10px);
  }
  100% {
    transform: translateX(0px);
  }
}
@keyframes scaleAnimationbottom {
  0% {
    transform: translateY(-20px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}
@keyframes scaleAnimationtop {
  0% {
    transform: translateY(20px);
  }
  50% {
    transform: translateY(10px);
  }
  100% {
    transform: translateY(0px);
  }
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值