晨对落日星对月 - 魏新雨
本帖最后由 亚伦影音工作室 于 2022-9-28 13:24 编辑 <br /><br /><style>#papa { margin: auto; width: 1200px; height: 630px; background: rgba(0,0,0,.45) url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/1931ff80693d35f1866d49c1c72d2425.jpg') no-repeat center/cover;margin-top:20px; margin-left:-300px;box-shadow: 0px 0px 0px 2px #ffffff, 0px 0px 0px 15px #880000;display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 0; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, purple, orange); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center; transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid tan; border-radius: 6px; opacity: 0; }
#btnplay { width: 20px; height: 20px; transform: translateX(3px); background: #eee; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, orange, purple 100%, transparent 0);font: normal 14px / 16px sans-serif; color: #ff0000; text-shadow: 1px 1px 0 #000; opacity: .8; }
#lrcwrap { position: absolute; top: 460px; font-family:华文隶书;font-size: 45px; }
#lrc1, #lrc2 { width: 100%; height: 100%; color: rgba(0,0,0,.3); white-space: nowrap; }
#lrc1{ width: 100%; height: 100%; color: #fff000; white-space: nowrap;filter:drop-shadow(#000080 1px 0 0)drop-shadow(#000080 0 1px 0)drop-shadow(#000080 -1px 0 0) drop-shadow(#000080 0 -1px0);}
#lrc2 { position: absolute; top: 0px; left: 0px; color: #FF0000; overflow: hidden;filter:drop-shadow(#FFFFFF 1px 0 0)drop-shadow(#FFFFFF 0 1px 0)drop-shadow(#FFFFFF -1px 0 0) drop-shadow(#FFFFFF 0 -1px0); }
#mpic { position: absolute; transform: rotateY(0deg); top: 0px; left: 0px; width: 1024px;height: 600px; animation: rote 40s linear infinite; cursor: pointer;opacity: .75; }
@keyframes rote {
0%{
background-position: 600% 0;
}
100%{
background-position: 300% 600%;filter:hue-rotate(360deg)
}
}
#mpic1 { position: absolute; transform: rotateY(0deg); top: 0px; left: 0px; width: 1024px;height: 600px; animation: rotet 100s linear infinite; cursor: pointer; opacity: 0.6;}
@keyframes rotet {
0%{
background-position: 0% -600%;
}
100%{
background-position: 0% 0%;filter:hue-rotate(360deg)
}
}
@keyframes fly { from { offset-distance: 0%; } to { offset-distance: 100%; } }
@keyframes mov1 { from { width: 0%;} to { width: 100%; } }
@keyframes mov2 { from { width: 0%;} to { width: 100%; } }
#disc { position: absolute; width: 100px; height: 100px; left: 30px; bottom: 30px; border:2px solid #000000;background: url(http://pan.yinhuabbs.cn/view.php/a60d7a6c4172d96080d4e23d80d9af48.png)0 0/100% 100%,conic-gradient(red,orange,yellow,green,teal,blue,#ff0000); mask: radial-gradient(transparent 7px,#red 0);-webkit-mask: radial-gradient(transparent 7px,red 0); border-radius: 50%; cursor: pointer; animation: rot 4s linear infinite; z-index: 20;transform: rotateX(45deg) rotateY(20deg) rotate(0deg);}
@keyframes rot {0% {transform: rotateX(45deg) rotateY(20deg) rotateZ(0deg);}
100% {transform: rotateX(45deg) rotateY(20deg) rotateZ(360deg);}
}
#photo img{width: 1200px;
height: 630px;
position: absolute;border:2px solid #ffffff;
top:0px; left:0px;filter:contrast(140%)brightness(100%);
opacity: 0;
animation-name: round ;animation-duration: 32s;
animation-iteration-count: infinite;
animation-timing-function: linear;}
@keyframes round { 0%{
opacity: 1;
transform: scale3d(0, 0, 0) translate3d(1000px, 0, 0);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
10% {
opacity: 1;
transform: scale3d(.8, .8, .8) translate3d(0px, 0, 0);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
12% {
opacity: 1;
transform: scale3d(.8, .8, .8) translate3d(0px, 0, 0);
animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
}
18%{
opacity: 1;
transform: scale3d(0, 0, 0) translate3d(-1000px, 0, 0);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
20%{
opacity: 0;
transform: scale3d(0, 0, 0) translate3d(-1000px, 0, 0);
animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190);
}
}
#photo img:nth-child(8) {animation-delay: 28s;}
#photo img:nth-child(7) {animation-delay: 24s;}
#photo img:nth-child(6) {animation-delay: 20s;}
#photo img:nth-child(5) {animation-delay: 16s;}
#photo img:nth-child(4) {animation-delay: 12s;}
#photo img:nth-child(3) {animation-delay: 8s;}
#photo img:nth-child(2) {animation-delay: 4s;}
#photo img:nth-child(1) {animation-delay: 0s;}
.stop #photo img:nth-child(1) {animation-play-state: paused;}
.stop #photo img:nth-child(2) {animation-play-state: paused;}
.stop #photo img:nth-child(3){animation-play-state: paused;}
.stop #photo img:nth-child(4) {animation-play-state: paused;}
.stop #photo img:nth-child(5) {animation-play-state: paused;}
.stop #photo img:nth-child(6) {animation-play-state: paused;}
.stop #photo img:nth-child(7) {animation-play-state: paused;}
.stop #photo img:nth-child(8) {animation-play-state: paused;}
</style>
<div id="papa" data-lr="no"><div id="testImg">
<divid="photo"><img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/2e5ca50fe35bdbdf841ee5ea8f762bf4.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/e5881593cfabb6c21cd46c44730f9d04.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/bd6af11966561814bed2f8a42a14d2e8.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/0e9d3187ae4797ec29a2178f0f5fccf5.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/f2a53a1e6e81b4cd7c41058d2ebd578d.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/02ed51985170a4b9db3f8e70cadb9396.jpg" /> <img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/35bde4351de72d52a856e23ff870c139.jpg" /><img src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/f2a53a1e6e81b4cd7c41058d2ebd578d.jpg" /> </div></div>
<imgid="mpic"style="width: 100%; height: 100%;background: url(http://image.hnol.net/c/2022-01/05/16/202201051650422421-5769293.png)0 0/50% 80%" >
<imgid="mpic1"style="width: 100%; height: 100%;background: url(http://image.hnol.net/c/2022-01/05/16/202201051650422421-5769293.png)0 0/30% 50%" >
<div id="lrcwrap">
<span id="lrc1">晨对落日星对月 - 魏新雨</span>
<span id="lrc2">晨对落日星对月 - 魏新雨</span>
</div>
<input type="button" id="testBtn" value="动画暂停"style="position: absolute;top: 0px; left: 0px;width: 130px; height: 30px;color: #ffffff;-webkit-background-clip : text;z-index: 2;"></input >
<span id="disc"></span>
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
</div>
<script>
let mKey = 0, mFlag = true, aud = new Audio();
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
aud.src = 'https://www.qqmc.com/mp3/music239167152.mp3';
aud.autoplay = true;
aud.loop = true;
disc.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () => disc.style.animationPlayState = 'running');
aud.addEventListener('pause', () => disc.style.animationPlayState = 'paused');
mpic.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () => mpic.style.animationPlayState = 'running');
aud.addEventListener('pause', () => mpic.style.animationPlayState = 'paused');
mpic1.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () => mpic1.style.animationPlayState = 'running');
aud.addEventListener('pause', () => mpic1.style.animationPlayState = 'paused');
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.background = 'linear-gradient(90deg, orange, purple ' + aud.currentTime / aud.duration * 100 + '%, snow 0)';
prog.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for (j = 0; j < lrcAr.length; j++) {
if (aud.currentTime >= lrcAr) {
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc2.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc2.style.animationPlayState = 'running');
let showLrc = (time) => {
lrc2.style.animation = (mFlag ? 'mov1 ' : 'mov2 ') + time + 's linear forwards';
lrc1.innerHTML = lrc2.innerHTML = lrcAr;
mKey += 1;
mFlag = !mFlag;
};
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 mtime = lrcAr - (aud.currentTime - lrcAr);
showLrc(mtime);
};
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;
};
var image = document.getElementById("testImg"),
button = document.getElementById("testBtn");
if (image.classList && image && button) {
button.onclick = function() {
if (this.value == '动画暂停') {
image.classList.add('stop');
this.value = '动画开启';
} else {
image.classList.remove('stop');
this.value = '动画暂停';
}
};
}
</script>
好听好看,制作得不错!{:4_190:} 漂亮的图片轮播效果。欣赏亚伦老师好帖{:4_187:}
页:
[1]