mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-15 02:43:08 +08:00
1 line
1.2 KiB
JavaScript
1 line
1.2 KiB
JavaScript
window.sparkInput=function(e,r){var l=r.map(function(r){return r+""}),n=["rgb(110,64,170)","rgb(150,61,179)","rgb(191,60,175)","rgb(228,65,157)","rgb(254,75,131)","rgb(255,94,99)","rgb(255,120,71)","rgb(251,150,51)","rgb(226,183,47)","rgb(198,214,60)","rgb(175,240,91)","rgb(127,246,88)","rgb(82,246,103)","rgb(48,239,130)","rgb(29,223,163)","rgb(26,199,194)","rgb(35,171,216)","rgb(54,140,225)","rgb(76,110,219)","rgb(96,84,200)"],i={text:"",prefixP:-5,skillI:0,skillP:0,direction:"forward",delay:2,step:1};!function r(){var t=l[i.skillI];i.step?i.step--:(i.step=1,i.prefixP<"".length?(0<=i.prefixP&&(i.text+=""[i.prefixP]),i.prefixP++):"forward"===i.direction?i.skillP<t.length?(i.text+=t[i.skillP],i.skillP++):i.delay?i.delay--:(i.direction="backward",i.delay=2):0<i.skillP?(i.text=i.text.slice(0,-1),i.skillP--):(i.skillI=(i.skillI+1)%l.length,i.direction="forward")),e.textContent=i.text,e.appendChild(function(r){for(var t=document.createDocumentFragment(),e=0;e<r;e++){var l=document.createElement("span");l.textContent=String.fromCharCode(94*Math.random()+33),l.style.color=n[Math.floor(Math.random()*n.length)],t.appendChild(l)}return t}(i.prefixP<"".length?Math.min(5,5+i.prefixP):Math.min(5,t.length-i.skillP))),setTimeout(r,75)}()}; |