New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css] 第60天 用css画一个太阳 #251
Labels
css
css
Comments
🔻 是有多无聊 // css
.sun {
margin: 200px;
width: 200px;
height: 200px;
border-radius: 50%;
background: red;
box-shadow: 0 0 21px #fe9e9e;
position: relative;
}
// ::before & ::after 辅助
.sun::before {
width: 0;
height: 500px;
content: '';
border-left: 1px solid blue;
position: absolute;
top: -150px;
left: 100px;
z-index: 100;
transform: rotate(45deg);
}
.sun::after {
width: 500px;
height: 0;
content: '';
border-top: 1px solid blue;
position: absolute;
top: 100px;
left: -150px;
z-index: 100;
transform: rotate(45deg);
}
// 光线的宽高据 sun-body 而动
.sun-light {
width: 100px;
height: 6px;
background: yellow;
position: absolute;
left: 0;
top: 0;
}
.sl1 {
left: 50px;
top: -58px;
transform: rotate(90deg);
}
.sl2 {
top: -14px;
left: 160px;
transform: rotate(-45deg);
}
.sl3 {
top: 97px;
left: 205px;
}
.sl4 {
top: 206px;
left: 160px;
transform: rotate(45deg);
}
.sl5 {
top: 252px;
left: 50px;
transform: rotate(90deg);
}
.sl6 {
top: 206px;
left: -60px;
transform: rotate(-45deg);
}
.sl7 {
top: 97px;
left: -105px;
}
.sl8 {
top: -14px;
left: -60px;
transform: rotate(45deg);
} <!-- html -->
<div class="sun">
<div class="sun-light sl1"></div>
<div class="sun-light sl2"></div>
<div class="sun-light sl3"></div>
<div class="sun-light sl4"></div>
<div class="sun-light sl5"></div>
<div class="sun-light sl6"></div>
<div class="sun-light sl7"></div>
<div class="sun-light sl8"></div>
</div> |
上面那位老哥的: CodePen 上的案例: |
<section class="c-sun">
<div class="c-sun__circle"></div>
<div class="c-sun__arrow" v-for="i in 10" :key="i"></div>
</section> .c-sun {
display: inline-block;
position: relative;
&__circle {
width: 60px;
height: 60px;
border-radius: 50%;
background: yellow;
}
&__arrow {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
@for $i from 1 to 12 {
&:nth-child(#{$i}) {
transform: translate(-50%, -50%) rotateZ($i * 36deg);
}
}
&:after {
position: absolute;
right: -25px;
content: "";
display: block;
border: 10px solid transparent;
border-left-color: #ffdc18;
animation: flashing 1s ease-in-out alternate-reverse infinite;
}
}
@keyframes flashing {
from {
opacity: .5;
transform: translate(10%, 10%);
}
}
}
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第60天 用css画一个太阳
The text was updated successfully, but these errors were encountered: