洋澜一 - 我用自己的方式爱你 (合唱版)(Live)
<style>#ks { margin: 150px -262px; width: 1360px; height: 715px;background:url()no-repeat center/cover;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 8px #562203; position: relative; overflow: hidden;border-radius: 22px 0px;bgcolor:#B222ff;}
#canv {display: block; position: absolute; top: 525px; left: 0px; }
#lrc { --motion: cover2; --tt: 2s;--state: paused;--bg: linear-gradient(45deg, hsla(230, 50%, 50%, .25), hsla(230, 30%, 50%, .45));position: absolute;left: 16%; top:8%;filter: drop-shadow( 0px 0px 1px #000000)drop-shadow( 0px 0px 1px #000000)drop-shadow( 0px 0px 1px #000000);font:normal 3em 幼圆;color:#fff222; z-index: 1; transform: translate(-30%, 10px);-webkit-background-clip: text;white-space: pre;}
#lrc::before { position: absolute; content: attr(data-lrc); color: transparent; width: 100%; height: 99%;white-space: pre; background: linear-gradient(90deg, #ffcc33 11%,#4DFFFF 27%,#CA8EFF 45%,#F8FBFB 57%,#42E028 76%,#FFFF00 95%);-webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
.txt{position: absolute; left: 26%; top: 75%; --c: Yellow;--w1: radial-gradient(100% 57% at top ,#0000 100%,var(--c) 100.5%) no-repeat;--w2: radial-gradient(100% 57% at bottom, var(--c) 100%,#0000 100.5%) no-repeat;background: var(--w1),var(--w2),var(--w1),var(--w2);background-position-x: -200%, -100%, 0%, 100%;background-position-y: 100%;background-size: 50.5% 100%;animation: m 2s infinite linear var(--state);font-size: 65px;font-weight: bold;color: transparent;-webkit-background-clip: text; -webkit-text-stroke: 2px var(--c); }@keyframes m {0%{background-position-x:-200%, -100%, 0%, 100%}100%{background-position-x:0%, 100%, 200%, 300%} }</style>
<div id="ks"><metaname="referrer" content="never"><videosrc="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/d065c4371f09b211b532ec0972b96565_preview.mp4" autoplay muted loop width="1450" height="1000" style="LEFT:-20px; POSITION: relative; TOP:-100px"></video><canvas id='canv' width="1450" height="232"></canvas><div id="lrc" data-lrc="HCPlayer">HCPlayer</div><div class="txt">我用自己的方式爱你</div><div>
<audio id="aud" src="https://aod.cos.tx.xmcdn.com/storages/ade2-audiofreehighqps/E0/8F/GMCoOSQJQ5mGACAAAAKGrCoi.m4a" loop="loop" autoplay="autoplay" crossOrigin="anonymous"></audio>
<script>
window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext;
window.onload = function() {
var audio = document.getElementById('aud');
var ctx = new AudioContext();
var analyser = ctx.createAnalyser();
var audioSrc = ctx.createMediaElementSource(aud);
audioSrc.connect(analyser);
analyser.connect(ctx.destination);
var frequencyData = new Uint8Array(analyser.frequencyBinCount);
var canvas = document.getElementById('canv'),
cwidth = canvas.width,
cheight = canvas.height - 9,
meterWidth = 9, //width of the meters in the spectrum
gap = 2, //gap between meters
capHeight = 2,
capStyle = '#fff',
meterNum = 2366 / (10 + 2),
capYPositionArray = []; //
ctx = canvas.getContext('2d'),
gradient = ctx.createLinearGradient(0, 22, 0, 300);
gradient.addColorStop(1, '#3366ff');
gradient.addColorStop(0.6, '#cc00cc');
gradient.addColorStop(0, '#fff000');
function renderFrame() { var array = new Uint8Array(analyser.frequencyBinCount);
analyser.getByteFrequencyData(array);
var step = Math.round(array.length / meterNum);
ctx.clearRect(0, 0, cwidth, cheight);
for (var i = 0; i < meterNum; i++) {
var value = array;
if (capYPositionArray.length < Math.round(meterNum)) {
capYPositionArray.push(value);
};
ctx.fillStyle = capStyle;
//draw the cap, with transition effect
if (value < capYPositionArray) {
ctx.fillRect(i * 12, cheight - (--capYPositionArray), meterWidth, capHeight);
} else {
ctx.fillRect(i * 12, cheight - value, meterWidth, capHeight);
capYPositionArray = value;
};
ctx.fillStyle = gradient; //set the filllStyle to gradient for a better look
ctx.fillRect(i * 12 /*meterWidth+gap*/ , cheight - value + capHeight, meterWidth, cheight); //the meter
}
requestAnimationFrame(renderFrame); }
renderFrame();
audio.play();};</script>
<script>
(function() {let mKey = 0, mFlag = true;let lrcTime = (ar) => {let tmpAr = [];for(j = 0; j <ar.length - 1; j ++) {if(j !== ar.length - 1) tmpAr = parseFloat((ar - ar).toFixed(1));}let aver = parseInt(tmpAr.reduce((a,b) => a + b) / (tmpAr.length - 1)) + averAdd;tmpAr.push(aver);tmpAr.forEach((item,key) => {ar = item > aver ? aver : item;});return ar;};
let averAdd = 0, offset = 0;
let getLrcAr = (text) => {let lrcAr = [];let calcRule = ;for(x of text.split('\n')) {let ar = [];let re = /\d+[\.:]\d+([\.:]\d+)?/g;let tbgc = x.replace(re,'');if(tbgc) {tbgc = tbgc.replace(/[\[\]\'\"\t,]s?/g,'');let time = x.match(re);if(time != null) {for(y of time) {let tmp = y.match(/\d+/g);let sec = 0;for(z in tmp) sec += tmp * calcRule;ar = ;lrcAr.push(ar); }}}}lrcAr.sort((a,b)=> a - b);return(lrcTime(lrcAr));}
let tbgc = `同一首\n同一首`;
let lrcAr = getLrcAr(tbgc);
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = lrcAr.replace(/<br>/, '\n');lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');ks.style.setProperty('--state', 'running');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 time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
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;}
let mState = () =>ks.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);else continue;}}})
mplayer.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());})();
</script>
<div><br><br><br><br>
页:
[1]