svg全链路流程轨迹

直接上效果
在这里插入图片描述

<template>
  <div class="right-page">
    <div class="container">
      <div class="line-wrap">
        <svg
          version="1.1"
          xmlns="http://www.w3.org/2000/svg"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xml:space="preserve"
          class="circle-load-rect-svg"
          viewBox="0 0 600 400"
        >
          <defs>
            <pattern
              id="line-pattern"
              patternUnits="userSpaceOnUse"
              width="80"
              height="30"
            >
              <image
                xlink:href="../../assets/1.png"
                x="-5"
                y="8"
                width="80"
                height="30"
              />
            </pattern>
          </defs>
          <polyline
            :points="svgData[0]"
            fill="none"
            class="g-rect-path"
            stroke="green"
          />
          <!-- stroke="url(#line-pattern)" -->
          <polyline
            :points="svgData[0]"
            fill="none"
            class="g-rect-fill"
            stroke="pink"
          />
        </svg>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {},
  data() {
    return {
      svgData: ["0,200 200,200 300,300 400,300 400,200 500,200"],
    };
  },
  computed: {},
  mounted() {},
  methods: {},
};
</script>

<style scoped lang="scss">
.circle-load-rect-svg {
  width: 800px;
}

.g-rect-path {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.g-rect-fill {
  fill: none;
  stroke-width: 10;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 10, 800;
  stroke-dashoffset: 0;

  animation: lineMove 5s cubic-bezier(0, 0, 0.74, 0.74) infinite;
}

@keyframes lineMove {
  0% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: -800;
  }
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值