mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
213 lines
3.6 KiB
HTML
213 lines
3.6 KiB
HTML
<div class="background">
|
|
<button class="change-theme__icon">
|
|
<span class="icon-sun-moon"></span>
|
|
<span class="sun-rays">
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
</span>
|
|
</button>
|
|
</div>
|
|
<style>
|
|
/* From Uiverse.io by ArturCodeCraft - Tags: icon, button, theme, theme-switch, menu, menuicon, menu button */
|
|
/* <reset-style> ============================ */
|
|
button {
|
|
border: none;
|
|
background: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
cursor: pointer;
|
|
font-family: inherit;
|
|
}
|
|
/* ============================ */
|
|
/* <style for bg> ======== */
|
|
.background {
|
|
border-radius: 16px;
|
|
border: 1px solid #1a1a1a;
|
|
background: rgba(74, 74, 74, 0.39);
|
|
mix-blend-mode: luminosity;
|
|
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.20);
|
|
backdrop-filter: blur(15px);
|
|
width: 65px;
|
|
height: 65px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
/* <style for change-theme__icon> ======== */
|
|
.change-theme__icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* .icon-sun-moon */
|
|
.change-theme__icon .icon-sun-moon {
|
|
width: 11.5px;
|
|
height: 11.5px;
|
|
border-radius: 100%;
|
|
background-color: rgb(28, 28, 30);
|
|
animation: ease reverse-change-theme .6s forwards;
|
|
transition: background-color .4s;
|
|
z-index: 10;
|
|
}
|
|
|
|
.change-theme__icon:hover .icon-sun-moon {
|
|
animation: change-theme .4s forwards;
|
|
background-color: #fff;
|
|
}
|
|
|
|
@keyframes change-theme {
|
|
0% {
|
|
width: 11.5px;
|
|
height: 11.5px;
|
|
}
|
|
|
|
100% {
|
|
width: 20px;
|
|
height: 20px;
|
|
}
|
|
}
|
|
|
|
@keyframes reverse-change-theme {
|
|
0% {
|
|
width: 20px;
|
|
height: 20px;
|
|
}
|
|
|
|
50% {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
|
|
100% {
|
|
width: 11.5px;
|
|
height: 11.5px;
|
|
}
|
|
}
|
|
|
|
/* .icon-sun-moon:before */
|
|
.change-theme__icon .icon-sun-moon:before {
|
|
content: '';
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 100%;
|
|
background-color: rgb(49,49,49);
|
|
position: absolute;
|
|
top: 2px;
|
|
right: -2px;
|
|
transform: translateX(100%) scale(.2);
|
|
transition: transform .4s;
|
|
}
|
|
|
|
.change-theme__icon:hover .icon-sun-moon:before {
|
|
transform: scale(1);
|
|
transition: transform .4s .12s;
|
|
}
|
|
|
|
/* sun-rays */
|
|
.sun-rays {
|
|
width: 22px;
|
|
height: 22px;
|
|
position: absolute;
|
|
}
|
|
|
|
.sun-rays span {
|
|
width: 2px;
|
|
height: 4px;
|
|
border-radius: 2px;
|
|
background-color: rgb(28, 28, 30);
|
|
position: absolute;
|
|
}
|
|
|
|
/* ray */
|
|
.sun-rays span:nth-child(1) {
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
.sun-rays span:nth-child(2) {
|
|
bottom: 0;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
.sun-rays span:nth-child(3) {
|
|
top: 50%;
|
|
left: 1px;
|
|
transform: translateY(-50%) rotate(90deg);
|
|
}
|
|
|
|
.sun-rays span:nth-child(4) {
|
|
top: 50%;
|
|
right: 1px;
|
|
transform: translateY(-50%) rotate(90deg);
|
|
}
|
|
|
|
.sun-rays span:nth-child(5) {
|
|
top: 2px;
|
|
right: 2.5px;
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
.sun-rays span:nth-child(6) {
|
|
bottom: 2px;
|
|
left: 2.5px;
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
.sun-rays span:nth-child(7) {
|
|
top: 2px;
|
|
left: 2.5px;
|
|
transform: rotate(-45deg);
|
|
}
|
|
|
|
.sun-rays span:nth-child(8) {
|
|
bottom: 2px;
|
|
right: 2.5px;
|
|
transform: rotate(-45deg);
|
|
}
|
|
|
|
.sun-rays {
|
|
animation: reverse-sun-rays .6s forwards;
|
|
}
|
|
|
|
.change-theme__icon:hover .sun-rays {
|
|
animation: ease sun-rays .4s forwards;
|
|
}
|
|
|
|
@keyframes sun-rays {
|
|
0% {
|
|
transform: rotate(0deg);
|
|
}
|
|
|
|
100% {
|
|
transform: rotate(-45deg);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
@keyframes reverse-sun-rays {
|
|
0% {
|
|
transform: rotate(-45deg);
|
|
}
|
|
|
|
50% {
|
|
transform: rotate(8deg);
|
|
}
|
|
|
|
100% {
|
|
transform: rotate(0deg);
|
|
}
|
|
}
|
|
</style>
|