美文网首页
高亮移动---边框组件

高亮移动---边框组件

作者: Spinach | 来源:发表于2022-12-26 15:34 被阅读0次

奇思妙想边框

<template>
  <div class="border-style">
    <slot name="contain" />
  </div>
</template>

<script>
export default {
  name: 'BorderStyle',
};
</script>

<style scoped lang="scss">
.border-style {
  width: 100%;
  height: 100%;
  background: rgba(2, 19, 21);
  box-shadow: 0 9px 41px 0px rgba(39, 205, 241, 0.4) inset;
  position: relative;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #ffffff;
    animation: clippath 5s infinite linear;
  }
}

@keyframes clippath {
  0%,
  100% {
    clip-path: inset(0 0 95% 0);
  }
  25% {
    clip-path: inset(0 95% 0 0);
  }
  50% {
    clip-path: inset(95% 0 0 0);
  }
  75% {
    clip-path: inset(0 0 0 95%);
  }
}
</style>

*************************** 不** 华** 丽** 的** 分** 割** 线***************************

<template>
  <div class="border-style">
    <slot name="contain" />
  </div>
</template>

<script>
export default defineComponent({
  name: 'BorderStyleNew',
});
</script>

<style scoped lang="scss">
*,
*::before,
*::after {
  box-sizing: border-box;
}

@keyframes rotate {
  100% {
    transform: rotate(1turn);
  }
}

.border-style {
  width: 100%;
  height: 100%;
  background: rgba(2, 19, 21);
  box-shadow: 0 9px 41px 0px rgba(39, 205, 241, 0.4) inset;

  position: relative;
  z-index: 0;
  //margin: 20px;
  border-radius: 10px;
  overflow: hidden;
  padding: 24px;

  &::before {
    content: '';
    position: absolute;
    z-index: -2;
    left: -50%;
    top: -50%;
    width: 200%;
    height: 200%;
    background-color: #1a232a;
    background-repeat: no-repeat;
    background-position: 0 0;
    background-image: conic-gradient(transparent, rgba(168, 239, 255, 1), transparent 30%);
    animation: rotate 5s linear infinite;
  }

  &::after {
    content: '';
    position: absolute;
    z-index: -1;
    left: 2px;
    top: 2px;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    background: rgba(2, 19, 21);
    box-shadow: 0 9px 41px 0px rgba(39, 205, 241, 0.4) inset;
    border-radius: 5px;
  }
}
</style>

相关文章

网友评论

      本文标题:高亮移动---边框组件

      本文链接:https://www.haomeiwen.com/subject/bzpfqdtx.html