何者般若
<style>#papa { left: -214px; width: 1024px; height: 640px; background: url('https://638183.freep.cn/638183/t22/webp/hzbr.webp') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .15;}
#papa::before { position: absolute; content: ''; width: 100%; height: 100%; background: url('https://638183.freep.cn/638183/t22/webp/126.gif') repeat; opacity: var(--opt); }
#mplayer { position: absolute; bottom: 20px; display: grid; grid-template-columns: auto auto; place-items: center; z-index: 9; }
#btnplay { width: 30px; height: 30px; border-radius: 50%; background: tan linear-gradient(hsla(120,100%,90%,.6), hsla(0,100%,50%,.6)); cursor: pointer; animation: rot linear 3s infinite; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; bottom: 60px; font: bold 2.4em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,100%,0%,.85)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(60,100%,50%,.75),hsla(120,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
</style>
<div id="papa">
<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
<div id="mplayer">
<span id="btnplay"></span>
<svg id="iplay" width="300" height="20">
<line id="track" x1="10" y1="10" x2="190" y2="10" stroke="hsla(60,40%,80%,0.5)" stroke-width="10" stroke-linecap="round" />
<line id="prog" x1="10" y1="10" x2="190" y2="10" stroke="hsla(0,100%,50%,0.5)" stroke-width="10" stroke-dasharray="180" stroke-dashoffset="180" stroke-linecap="round" />
<text id="audtime" x="200" y="15" font-size="14" fill="hsl(0,0%,100%)">00:00 | 00:00</text>
</svg>
</div>
</div>
<script>
(function() {
let len = track.getTotalLength(), aud = new Audio(), mKey = 0, mFlag = true;
aud.src = 'http://www.kumeiwp.com/sub/filestores/2022/10/19/810379d3e2e195ffc9cb66b84938bd37.mp3';
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
aud.loop = true;
aud.autoplay = true;
btnplay.style.animationPlayState = aud.paused ? 'paused' : 'running';
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('seeked', () => calcKey());
prog.onclick = track.onclick = (e) => aud.currentTime = aud.duration * (e.offsetX - 10) / len;
aud.addEventListener('pause', () =>mState());
aud.addEventListener('play', () =>mState());
aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = len - aud.currentTime * len / aud.duration;audtime.textContent = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);for(j=0; j<lrcAr.length; j++) {if(aud.currentTime >= lrcAr) {cKey = j;if(mKey === j) showLrc(lrcAr);else continue;}}});
let calcKey = () => {for(j = 0; j < lrcAr.length; j ++) {if(aud.currentTime <= lrcAr) {mKey = j - 1;break;}}if(mKey <0) mKey = 0;if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
let mState = () => aud.paused ? (btnplay.style.animationPlayState = 'paused',lrc.style.setProperty('--state', 'paused'),papa.style.setProperty('--opt','0')) : (btnplay.style.animationPlayState = 'running', lrc.style.setProperty('--state', 'running'),papa.style.setProperty('--opt','.15'));
let toMin = (val)=> {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60), sec = parseFloat(val % 60);if(min < 10) min = '0' + min;if(sec < 10) sec = '0' + sec;return min + ':' + sec;}
})();
</script>
代码
<style>
#papa { margin: auto; width: 1024px; height: 640px; background: url('https://638183.freep.cn/638183/t22/webp/hzbr.webp') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .15;}
#papa::before { position: absolute; content: ''; width: 100%; height: 100%; background: url('https://638183.freep.cn/638183/t22/webp/126.gif') repeat; opacity: var(--opt); }
#mplayer { position: absolute; bottom: 20px; display: grid; grid-template-columns: auto auto; place-items: center; z-index: 9; }
#btnplay { width: 30px; height: 30px; border-radius: 50%; background: tan linear-gradient(hsla(120,100%,90%,.6), hsla(0,100%,50%,.6)); cursor: pointer; animation: rot linear 3s infinite; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; bottom: 60px; font: bold 2.4em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,100%,0%,.85)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(60,100%,50%,.75),hsla(120,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
</style>
<div id="papa">
<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
<div id="mplayer">
<span id="btnplay"></span>
<svg id="iplay" width="300" height="20">
<line id="track" x1="10" y1="10" x2="190" y2="10" stroke="hsla(60,40%,80%,0.5)" stroke-width="10" stroke-linecap="round" />
<line id="prog" x1="10" y1="10" x2="190" y2="10" stroke="hsla(0,100%,50%,0.5)" stroke-width="10" stroke-dasharray="180" stroke-dashoffset="180" stroke-linecap="round" />
<text id="audtime" x="200" y="15" font-size="14" fill="hsl(0,0%,100%)">00:00 | 00:00</text>
</svg>
</div>
</div>
<script>
(function() {
let len = track.getTotalLength(), aud = new Audio(), mKey = 0, mFlag = true;
aud.src = 'http://www.kumeiwp.com/sub/filestores/2022/10/19/810379d3e2e195ffc9cb66b84938bd37.mp3';
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
aud.loop = true;
aud.autoplay = true;
btnplay.style.animationPlayState = aud.paused ? 'paused' : 'running';
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('seeked', () => calcKey());
prog.onclick = track.onclick = (e) => aud.currentTime = aud.duration * (e.offsetX - 10) / len;
aud.addEventListener('pause', () =>mState());
aud.addEventListener('play', () =>mState());
aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = len - aud.currentTime * len / aud.duration;audtime.textContent = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);for(j=0; j<lrcAr.length; j++) {if(aud.currentTime >= lrcAr) {cKey = j;if(mKey === j) showLrc(lrcAr);else continue;}}});
let calcKey = () => {for(j = 0; j < lrcAr.length; j ++) {if(aud.currentTime <= lrcAr) {mKey = j - 1;break;}}if(mKey <0) mKey = 0;if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;let time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
let mState = () => aud.paused ? (btnplay.style.animationPlayState = 'paused',lrc.style.setProperty('--state', 'paused'),papa.style.setProperty('--opt','0')) : (btnplay.style.animationPlayState = 'running', lrc.style.setProperty('--state', 'running'),papa.style.setProperty('--opt','.15'));
let toMin = (val)=> {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60), sec = parseFloat(val % 60);if(min < 10) min = '0' + min;if(sec < 10) sec = '0' + sec;return min + ':' + sec;}
})();
</script>
本帖:
① HTML主干
<div id="papa">
<div id="lrc" data-lrc="花潮lrc在线"><!-- 歌词同步 --></div>
<div id="mplayer"><!-- html按钮 + svg进度条 --></div>
</div>
其中,播放器:
<span id="btnplay"></span> <!-- 按钮 -->
<svg id="iplay" width="300" height="20"> <!-- 进度条 -->
<line id="track" x1="10" y1="10" x2="190" y2="10" stroke="hsla(60,40%,80%,0.5)" stroke-width="10" stroke-linecap="round" />
<line id="prog" x1="10" y1="10" x2="190" y2="10" stroke="hsla(0,100%,50%,0.5)" stroke-width="10" stroke-dasharray="180" stroke-dashoffset="180" stroke-linecap="round" />
<text id="audtime" x="200" y="15" font-size="14" fill="hsl(0,0%,100%)">00:00 | 00:00</text>
</svg>
② 修改样式
歌词颜色 :CSS 中 #lrc 和 #lrc::before 的 color 属性
按钮颜色 :CSS 中的 #btnplay 的 background 属性
进度条颜色 :HTML代码中的 <svg ...> 部分,两个 line 标签,id="track" 的是轨道,id="prog"的是进度,stroke="颜色"
关于帖子闪烁背景
相信很多朋友一眼能看出,这是GIF图片效果。图片是这个——
https://638183.freep.cn/638183/t22/webp/126.gif
小图片做 #papa 伪元素背景,repeat 它。 般(bō)若(rè)无形象,华言大智慧。若有智慧者,处处皆般若。
般若无好坏,不生亦不灭,不住而常在,如风无缚脱。
问若何者是般若,五阴六入十八界。愚痴智慧性空寂,来去无碍露堂堂。 般若经:
“般若”是“般若波罗蜜多”的略称,是指一种大乘佛教的佛、菩萨所具有的不同于凡俗之人的智慧,它既是大乘佛教修行所要达到的目的,也是观察一切事物的准则。般若类经典在印度出现较早,大约在印度案达罗王朝中叶(约公元一世纪中叶),般若类佛经就已问世,龙树时代(公元二或三世纪)流行的般若类经典有《小品般若》和《大品般若》两种。所谓“大品”、“小品”是指两部《般若经》在篇幅上有大小长短的区分,而它们的中心内容是基本相同的。最早传入中国的大乘般若经是东汉末年的支娄迦谶在灵帝中平年间(公元178—189年)所译的《道行般若经》十卷。 佛教的出现与发展,与侵略息息相关:侵略者征服了土著人后,为了控制住土著奴隶,同时也为了在“内部”稳住思想,弄出了很多套意识形态,要人们相信今天的苦是将来灵魂升华的必修课,今天的修行是因,将来轮回投胎就可以不是生为猪狗,是修行的果;总而言之,要大家接受与正视现实,不去纠缠利益阶层间不可调和的矛盾,要从内心深处彻底接受当下的一切,努力修行(因),为轮回做准备,将来(果)是美好的。 进入帖子,第一反应,以为是auto-fill 的应用,原来是昨天讲的svg进度条{:4_173:}
这背景图是上海外滩陆家嘴,而且是比较新的,有上海中心呢。 马黑黑 发表于 2022-10-20 07:34
关于帖子闪烁背景
相信很多朋友一眼能看出,这是GIF图片效果。图片是这个——
嗯,加上这些变得很玄幻。真漂亮。透明度从0.15到0,暂停就不见了。很不错的构思{:4_199:} 马黑黑 发表于 2022-10-20 07:51
佛教的出现与发展,与侵略息息相关:侵略者征服了土著人后,为了控制住土著奴隶,同时也为了在“内部”稳住 ...
这个貌似说出了这个宗教的本质,让人们相信因果,以今生修来世,从而放弃反抗。 欣赏精美音画佳作! 谢谢黑黑朋友在做图的同时还介绍了许多背景资料和知识。 这个前景效果漂亮,好象评分了就出来二个声音了 漂亮的制作。赞! 加林森 发表于 2022-10-20 11:50
漂亮的制作。赞!
{:4_190:} 红影 发表于 2022-10-20 08:56
进入帖子,第一反应,以为是auto-fill 的应用,原来是昨天讲的svg进度条
这背景图是上海外滩陆 ...
auto-fill 在这里用不上的
外景不错呢,俺上个月到过那里一下下,匆忙路过 红影 发表于 2022-10-20 08:58
嗯,加上这些变得很玄幻。真漂亮。透明度从0.15到0,暂停就不见了。很不错的构思
透明度仅在音乐暂停是改变,音乐播放时,伪元素的不透明度一直是 0.15 醉美水芙蓉 发表于 2022-10-20 11:45
欣赏黑黑老师新帖!
{:4_190:} 绿叶清舟 发表于 2022-10-20 10:57
这个前景效果漂亮,好象评分了就出来二个声音了
这是对评分的鼓励:声音加倍