按钮组件草稿

<template>
   <div class="zj-button">
        <div class="button-box">
            <button><a class="a">这个</a></button>
        </div>
    </div>
</template>

<script>
	export default {
		name: 'zj-button',
		data() {
			return {
            };
		},
	}
</script>

<style>
.zj-button {
    width: 100%;
    height: 100%;
}
.zj-button .button-box { 
    position: relative;
    height: 100%;
    width: 100%;
}
.zj-button .button-box button {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    border: 0;
    border-radius: 10px;
    background-color: #182848;
    z-index: 100;
}
.zj-button .button-box button a {
    text-decoration: none;
    color: #fff;
    background: linear-gradient(-45deg, #ff00c1, #00fff9);
    /* 背景只有文字有   除了文字  其他都被裁剪掉 */
    -webkit-background-clip: text;
    /* 表示文字颜色填充 */
    -webkit-text-fill-color: transparent;
}
.zj-button .button-box .button::after, .button-box::before { 
    content: "";
    width: 110%;
    height: 110%;
    border-radius: 10px;
    box-sizing: border-box;
    position: absolute;
    left: -5%; top: -5%;
    /* var(--rotate) 一个变量  变量名为--rotate*/
    background: linear-gradient(var(--rotate),#FF00c1 0%, #9600ff 25%, #4900ff 50%, #00b8ff 80%, #00fff9 100%);
    z-index: 1;
}

.button-box:hover::after, .button-box:hover::before {
    /* 给变量重新赋值 */
    --rotate: 3600deg;
    /* 过渡 */
    transition: --rotate 20s linear;
}
.button-box:hover::before {
    /* 动画的执行 */
    animation: fade 1.2s;
}

/* 定义一个变量  --rotate   值为130deg   类型为<angle>   不继承 */
@property --rotate { initial-value: 130deg; syntax: '<angle>';  inherits: false; }
/* 定义动画 */
@keyframes fade {
    0% {
        /* 透明度为1 */
        opacity: 1;
        transform: scale(1);
        filter: blur(10px)
    }
    100% { 
        /* 透明度为0 */
        opacity: 0;
        /* 等比例缩放 放大1.2倍 */
        transform: scale(1.2);
        /* 模糊程度 */
        filter: blur(10px)
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值