gpt4 book ai didi

css - 如何给三 Angular 形添加渐变?

转载 作者:行者123 更新时间:2023-12-02 17:59:55 25 4
gpt4 key购买 nike

如何将渐变颜色应用于三 Angular 形?

https://jsfiddle.net/otz9ewm8/

.spinner::before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 27px solid #B76BF0;
transform: translateX(4px);
z-index: 0;
}

如何在代码中完成此操作?

.spinner {
-webkit-appearance: none;
appearance: none;
border: none;
padding: 0;
display: block;
cursor: pointer;
/*background: rgba(255, 255, 255, 0.1);*/
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
box-sizing: border-box;
background-clip: padding-box;
/* -webkit-mask: linear-gradient(rgba(0, 0, 0, 0.1), #000000 90%);*/
width: 90px;
height: 90px;
border-radius: 50%;
transform-origin: 50% 55%;
transform: perspective(90px) rotateX(30deg);
animation: spinner-wiggle 5.2s infinite;
}

.spinner::before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 27px solid #B76BF0;
transform: translateX(4px);
z-index: 0;
}




@keyframes spinner-wiggle {
30% {
transform: perspective(90px) rotateX(10deg);
}

40% {
transform: perspective(90px) rotateX(7deg);
}

50% {
transform: perspective(90px) rotateX(10deg);
}

60% {
transform: perspective(90px) rotateX(8deg);
}
}

.color-circle {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
width: 90px;
height: 90px;
transform-origin: 50% 50%;
background: -webkit-gradient(linear,
left top,
left bottom,
color-stop(50%, #25d8fb),
color-stop(100%, #4f66bb));
border-radius: 50%;
z-index: 0;
box-shadow: inset 0 24px 18px -10px rgba(0, 0, 140, 0.3),
inset 0 0 22px -2px rgba(0, 0, 0, 0.4);
cursor: pointer;

background: linear-gradient(100deg, #24A4EA, #379DEB 25%, #B76BF0);
-webkit-mask-image: radial-gradient(circle, transparent 0 36px, black 36px);
mask-image: radial-gradient(circle, transparent 0 50px, black 20px);
}

.spinner:hover .color-circle {
background: -webkit-gradient(linear,
left top,
left bottom,
color-stop(50%, rgba(34, 204, 0, 0.9)),
color-stop(100%, #55ff00));
}

.color-circle:before {
content: "";
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
width: 72px;
height: 72px;
border-radius: 50%;
background-color: #353198;
z-index: 0;
}

.spinner:hover .color-circle {
animation: spin 1.7s infinite linear;
}

@-webkit-keyframes spin {
0% {
transform: rotateZ(0deg);
}

100% {
transform: rotateZ(360deg);
}
}
<div class=" spinner">
<span class="color-circle"></span>
</div>

最佳答案

您可以使用clip-path instead of borders

  background-image: linear-gradient(100deg, #24A4EA, #379DEB 25%, #B76BF0);
clip-path: polygon(0% 0%, 100% 50%, 0% 100%);

关于css - 如何给三 Angular 形添加渐变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74654679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com