Advertisement
fido_27

tailwind not updating

Aug 6th, 2024
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use client'
  2.  
  3. function magicColor(arrColor:Array<string> , arrVal:Array<string>) {
  4.     let c = ""
  5.     let randomIndex
  6.     let item
  7.     randomIndex = Math.floor(Math.random() * arrColor.length)
  8.     item = arrColor[randomIndex]
  9.     c += item + "-"
  10.     randomIndex = Math.floor(Math.random() * arrVal.length)
  11.     item = arrVal[randomIndex]
  12.     c += item
  13.     console.log(c)
  14.     return c
  15. }
  16.  
  17. async function colorSeconds() {
  18.     const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
  19.  
  20.     let seconds = document.getElementById("seconds")
  21.     let seconde = document.getElementById("seconde")
  22.     let secondc = document.getElementById("secondc")
  23.     let secondo = document.getElementById("secondo")
  24.     let secondn = document.getElementById("secondn")
  25.     let secondd = document.getElementById("secondd")
  26.  
  27.     const colorArr = ["slate" , "gray" , "zinc" , "neutral" , "stone" , "red" , "orange" , "amber" , "yellow" , "lime" , "green" , "emerald" , "teal" , "cyan" , "sky" , "blue" , "indigo" , "violet" , "purple" , "fuchsia" , "pink" , "rose"]
  28.     const numArr = ["50" , "100" , "200" , "300" , "400" , "500" , "600" , "700" , "800" , "900"]
  29.  
  30.     let magicClr
  31.     while (1) {
  32.         await sleep(1000)
  33.         magicClr = magicColor(colorArr , numArr)
  34.         await sleep(1000)
  35.         seconds!.className = "text-" + magicClr
  36.         await sleep(1000)
  37.         seconde!.className = "text-" + magicClr
  38.         await sleep(1000)
  39.         secondc!.className = "text-" + magicClr
  40.         await sleep(1000)
  41.         secondo!.className = "text-" + magicClr
  42.         await sleep(1000)
  43.         secondn!.className = "text-" + magicClr
  44.         await sleep(1000)
  45.         secondd!.className = "text-" + magicClr
  46.         await sleep(1000)
  47.     }
  48. }
  49.  
  50. export default function Home() {
  51.  
  52.     return (
  53.         <main onClick={colorSeconds} className="p-6 w-5/6 text-2xl text-center">
  54.             <span id="seconds" className="text-white">s</span>
  55.             <span id="seconde" className="text-white">e</span>
  56.             <span id="secondc" className="text-white">c</span>
  57.             <span id="secondo" className="text-white">o</span>
  58.             <span id="secondn" className="text-white">n</span>
  59.             <span id="secondd" className="text-white">d</span>
  60.         </main>
  61.     )
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement