本帖最后由 花简静 于 2024-8-18 15:14 编辑
<css-doodle id="mplayer">
:doodle {
margin: -80px 0 0 calc(50% - 593px);
@grid: 26x1 / 1024px 640px;
background: #eee url('https://638183.freep.cn/638183/t23/1/r3.jpg') no-repeat center / cover;
box-shadow: 0 0 8px #000;
pointer-events: none;
position: relative;
-webkit-box-reflect: below 0px linear-gradient(transparent,transparent 85%,rgba(0,0,0,.8));
--state: paused;
}
--colors: (#75b9be,#696d7d,#d72638,#f49d37,#140f2d);
--color-1: @p(--colors);
--color-2: @P;
--transform: translateY(@r(2, 90)%);
--size: 30px;
transform: var(--transform) rotate(0deg);
transform-origin: 50% 100%;
@random(0.5) { animation: swing @r(3, 5)s ease infinite alternate both; }
@random(0.5) { animation: swingLeft @r(3, 5)s ease infinite alternate both; }
@keyframes swing {
0% { transform: var(--transform) rotate(0deg); }
100% { transform: var(--transform) rotate(1deg); }
}
@keyframes swingLeft {
0% { transform: var(--transform) rotate(0deg); }
100% { transform: var(--transform) rotate(-1deg); }
}
@keyframes rot {
0% { transform: var(--transform) rotate(0deg); }
100% { transform: var(--transform) rotate(360deg); }
}
::after {
content: "";
position: absolute;
top: -15px;
left: calc(50% - var(--size) / 2);
width: var(--size);
height: var(--size);
background: @p(
radial-gradient(@stripe(@m4(var(--color-@pn(1, 2))), transparent 29.7%)),
@doodle(
@grid: 1 / 100%;
::after {
content: "@p(✿,❁,❀,❃,❊)";
position: absolute;
top: -4px;
left: 50%;
transform: translate3d(-50%, 0, 0);
font-size: 40px;
color: transparent;
background-image: radial-gradient(var(--color-1) 20%, var(--color-2) calc(20% + 0.5px));
-webkit-background-clip: text;
}
),
@doodle(
@grid: 1 / 100%;
::after {
content: "@p(🌸,🌼)";
position: absolute;
top: 0;
left: 50%;
transform: translate3d(-50%, 0, 0);
font-size: 28px;
color: transparent;
background-image: radial-gradient(var(--color-1) 20%, var(--color-2) calc(20% + 0.5px));
-webkit-background-clip: text;
}
)
);
}
background: @doodle(
@grid: 1x40;
background: linear-gradient(90deg, @stripe(transparent, @p(--colors) 2px, transparent));
@nth(1, 2) {
::before { display: none; }
}
@random(.5) {
::before {
content: "";
@place: 10px center;
@size: 50% 100%;
border-radius: 0 100% 0 100%;
background: @p(--colors);
-webkit-box-reflect: @p(right, initial);
}
}
);
@at(@X, @Y) {
@size: 100px;
@shape: clover 4;
@place: 50% 10%;
background: crimson;
transform-origin: 50% 50%;
animation: rot 6s infinite linear var(--state);
::before { display: none; }
::after { display: none; }
cursor: pointer;
pointer-events: auto;
}
</css-doodle>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1436678253" autoplay loop></audio>
<script>
(function() {
let script = document.createElement('script');
script.src = 'https://unpkg.com/css-doodle@0.34.9/css-doodle.min.js';
document.head.appendChild(script);
let mState = () => mplayer.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('play', mState, false);
aud.addEventListener('pause', mState, false);
mplayer.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script>
|