马黑黑 发表于 2024-2-5 11:36

倒影

<style>
#papa { margin: 0 0 0 calc(50% - 681px); width: 1200px; height: 800px; background: url('https://638183.freep.cn/638183/t24/jpg/f7.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; overflow: hidden; z-index: 1; display: grid; place-items: center; }
#papa::before { position: absolute; content: ''; inset: 0 0 0 0; background: radial-gradient(lightgreen, transparent,green); opacity: .35; }
#papa video { position: absolute; top: -70px; width: 100%; height: calc(100% + 70px); object-fit: cover; mix-blend-mode: color-dodge; opacity: .4; }
#lrc { position: absolute; top: 10px; font: bold 2.4em sans-serif; color: lightblue; text-shadow: 1px 1px 1px rgba(0,0,0,.45); user-select: none; --ani: lrcGo1; --duration: 1s; }
#lrc::before { position: absolute; content: attr(data-lrc); width: 100%; height: 100%; color: transparent; background: repeating-linear-gradient(90deg, lightblue 3px, green 6px); background-clip: text; -webkit-background-clip: text; clip-path: inset(0 100% 0 0); border-bottom: 2px dashed lightblue; animation: var(--ani) var(--duration) linear forwards var(--state); }
#mplayer { position: absolute; bottom: 10px; text-align: center; color: lightblue; }
#mplayer::before { position: absolute; content: attr(data-tt); left: 0; bottom: 25px; width: 100%; text-align-last: justify; }
#mprog { width: 280px; accent-color: darkgreen; outline: none; cursor: pointer; }
#mprog:focus { accent-color: gold; }
#btnplay { width: 80px; height: 80px; cursor: pointer; animation: rotating 6s infinite linear var(--state); }
#btnplay:hover { filter: invert(.2); }
@keyframes rotating { to { transform: rotate(360deg); } }
@keyframes lrcGo0 { to { clip-path: inset(0 0 0 0); } }
@keyframes lrcGo1 { to { clip-path: inset(0 0 0 0); } }
</style>

<div id="papa">
        <audio src="https://music.163.com/song/media/outer/url?id=1897356369" autoplay loop></audio>
        <video src="https://img.tukuppt.com/video_show/15653652/01/04/43/614448e498100.mp4" loop muted></video>
        <div id="mplayer" data-tt="0:00 0:00">
                <img id="btnplay" src="https://638183.freep.cn/638183/t23/btn/meihua_133482968750383750.png" title="播放/暂停" alt="" /><br>
                <input id="mprog" type="range" min="0" max="100" step="any" value="0" title="调节进度"    />
        </div>
        <div id="lrc" data-lrc="HuaChao LRC">HuaChao LRC</div>
</div>

<script>
var sF = document.createElement('script');
sF.src = 'https://638183.freep.cn/638183/web/js/rangelrc2024.js';
sF.charset = 'utf-8';
document.querySelector('body').appendChild(sF);
var geci = [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ];
</script>

马黑黑 发表于 2024-2-5 11:37

帖子代码
<style>
#papa { margin: 0 0 0 calc(50% - 681px); width: 1200px; height: 800px; background: url('https://638183.freep.cn/638183/t24/jpg/f7.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; overflow: hidden; z-index: 1; display: grid; place-items: center; }
#papa::before { position: absolute; content: ''; inset: 0 0 0 0; background: radial-gradient(lightgreen, transparent,green); opacity: .35; }
#papa video { position: absolute; top: -70px; width: 100%; height: calc(100% + 70px); object-fit: cover; mix-blend-mode: color-dodge; opacity: .4; }
#lrc { position: absolute; top: 10px; font: bold 2.4em sans-serif; color: lightblue; text-shadow: 1px 1px 1px rgba(0,0,0,.45); user-select: none; --ani: lrcGo1; --duration: 1s; }
#lrc::before { position: absolute; content: attr(data-lrc); width: 100%; height: 100%; color: transparent; background: repeating-linear-gradient(90deg, lightblue 3px, green 6px); background-clip: text; -webkit-background-clip: text; clip-path: inset(0 100% 0 0); border-bottom: 2px dashed lightblue; animation: var(--ani) var(--duration) linear forwards var(--state); }
#mplayer { position: absolute; bottom: 10px; text-align: center; color: lightblue; }
#mplayer::before { position: absolute; content: attr(data-tt); left: 0; bottom: 25px; width: 100%; text-align-last: justify; }
#mprog { width: 280px; accent-color: darkgreen; outline: none; cursor: pointer; }
#mprog:focus { accent-color: gold; }
#btnplay { width: 80px; height: 80px; cursor: pointer; animation: rotating 6s infinite linear var(--state); }
#btnplay:hover { filter: invert(.2); }
@keyframes rotating { to { transform: rotate(360deg); } }
@keyframes lrcGo0 { to { clip-path: inset(0 0 0 0); } }
@keyframes lrcGo1 { to { clip-path: inset(0 0 0 0); } }
</style>

<div id="papa">
        <audio src="https://music.163.com/song/media/outer/url?id=1897356369" autoplay loop></audio>
        <video src="https://img.tukuppt.com/video_show/15653652/01/04/43/614448e498100.mp4" loop muted></video>
        <div id="mplayer" data-tt="0:00 0:00">
                <img id="btnplay" src="https://638183.freep.cn/638183/t23/btn/meihua_133482968750383750.png" title="播放/暂停" alt="" /><br>
                <input id="mprog" type="range" min="0" max="100" step="any" value="0" title="调节进度"    />
        </div>
        <div id="lrc" data-lrc="HuaChao LRC">HuaChao LRC</div>
</div>

<script>
var sF = document.createElement('script');
sF.src = 'https://638183.freep.cn/638183/web/js/rangelrc2024.js';
sF.charset = 'utf-8';
document.querySelector('body').appendChild(sF);
var geci = [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ];
</script>

马黑黑 发表于 2024-2-5 11:37

本帖最后由 马黑黑 于 2024-2-5 12:28 编辑

本帖使用的 JS 资源封装自 range进度条播放器+LRC歌词同步教程(五)的终结代码, 仅做少量改动(audio 可以不需要id)。
JS资源地址:https://638183.freep.cn/638183/web/js/rangelrc2024.js

资源可以存为自用文件,可以随意修改,可以不标明出处。

几点说明:

(一)JS资源对CSS、HTML有相应约定:

    ① HTML结构 要求帖子内包含:

        <div id="mplayer" data-tt="0:00 0:00">
                <img id="btnplay" src="音乐地址" title="播放/暂停" alt="" /><br>
                <input id="mprog" type="range" min="0" max="100" step="any" value="0" title="调节进度"    />
        </div>
        <div id="lrc" data-lrc="HuaChao LRC">HuaChao LRC</div>


    红色部分的id标识不可或缺。

    ② CSS伪元素设计 :#mplayer + 伪元素;#lrc + 伪元素

    详情请参考对应上述HTML的id的CSS代码。

    ③ 歌词数组为花潮格式,要求必须命名为 geci 。

红影 发表于 2024-2-5 14:46

这个也被黑黑做成插件了,太好了{:4_199:}

红影 发表于 2024-2-5 14:52

JS里只有歌词就够了呢。range获得焦点的时候,还会变色的,标色后键盘也能操控了{:4_187:}

红影 发表于 2024-2-5 14:54

原来上键也能操控,和右键是一样的,左和下就是同样的功能了。

红影 发表于 2024-2-5 14:57

这个封装把歌词的css留在外面的好,就可以想要什么颜色和大小都自己调了。
这个视频效果太棒了,非常大气的制作。
歌曲也好听,歌词像一首诗句呢{:4_187:}

红影 发表于 2024-2-5 14:58

竖线条的歌词和下划线,都让同步歌词那么美。这个帖子太棒了{:4_199:}

小辣椒 发表于 2024-2-5 16:25

又一个歌词同步的{:4_199:}

小辣椒 发表于 2024-2-5 16:26

黑黑现在图意和歌曲很相配了{:4_199:}

小辣椒 发表于 2024-2-5 16:36

这个插件今天去做一个,直接套用就可以了,昨天那个代码还多一点,今天是代码都少许多了

马黑黑 发表于 2024-2-5 18:19

红影 发表于 2024-2-5 14:46
这个也被黑黑做成插件了,太好了

独立出来,不是插件

马黑黑 发表于 2024-2-5 18:19

小辣椒 发表于 2024-2-5 16:36
这个插件今天去做一个,直接套用就可以了,昨天那个代码还多一点,今天是代码都少许多了

CSS多一些,不过都是容易看得出来的

马黑黑 发表于 2024-2-5 18:19

小辣椒 发表于 2024-2-5 16:26
黑黑现在图意和歌曲很相配了

还好还好

马黑黑 发表于 2024-2-5 18:20

红影 发表于 2024-2-5 14:52
JS里只有歌词就够了呢。range获得焦点的时候,还会变色的,标色后键盘也能操控了

获得焦点后变色,失去焦点变回来

马黑黑 发表于 2024-2-5 18:20

小辣椒 发表于 2024-2-5 16:25
又一个歌词同步的

{:4_190:}

马黑黑 发表于 2024-2-5 18:20

红影 发表于 2024-2-5 14:54
原来上键也能操控,和右键是一样的,左和下就是同样的功能了。

上下左右键都可以操作的

马黑黑 发表于 2024-2-5 18:21

红影 发表于 2024-2-5 14:58
竖线条的歌词和下划线,都让同步歌词那么美。这个帖子太棒了

感谢认可

马黑黑 发表于 2024-2-5 18:22

红影 发表于 2024-2-5 14:57
这个封装把歌词的css留在外面的好,就可以想要什么颜色和大小都自己调了。
这个视频效果太棒了,非常大气 ...

词曲都不错,两位歌手的演唱也很用心

樵歌 发表于 2024-2-5 18:30

所有元素都和谐美好!看了又看,差点迷失其中鸟{:4_174:}
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 倒影