word OK มาจากฟ้า (Copy 1266) (Branch 1507)
✨ APICHET KOMWATCHARAPONG
<html> <head> <title>Let's Start </title> <style> body { background-image: url('https://media.discordapp.net/attachments/806442516307902495/806874321288691763/90_20210204152045.png?width=717&height=335'); background-size: 100vw 100vh; background-position: top center; } .background { position: absolute; background-color: rgba(0, 0, 0, 0.7); height: 100vh; width: 80vw; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: -1; } .platform { height: 50px; width: 100%; background-color: black; } .t_rex { height: 120px; width: 150px; left: 50%; margin: auto; margin-top: 380px; background-image: url("https://cdn.discordapp.com/attachments/806442516307902495/807077361891541023/20210204_223459.gif"); background-size: cover; } .box_input { margin: auto; margin-top: 15px; height: 40px; width: 50vw; } .box_input input { height: 100%; width: 100%; } .circle { --l: 0; background-color: red; padding: .3em; margin: .2em .5em; position: absolute; top: 0%; transition: top 2s linear; } </style> </head> <body> <div class="main"> </div> <div class="background"> <div class="t_rex"> </div> <div class="platform"> </div> <div class="box_input"> <input id="input_word"> </div> </div> <script> const dicts = ["run", "go", "cat", "ant", "bat", "no", "we", "you", "me", "yes"] // const wordElem = document.querySelectorAll('a-word') const mainElem = document.querySelector(".main") let i = 0 let words = [] function run() { words.push(dicts[randomWord(dicts)]) createWord(words[i]) i++ } function randomWord(range) { let rangeSize = range.length return Math.floor(Math.random() * rangeSize) } function createWord(word) { const createElem = document.createElement('a-word') createElem.innerText = word createElem.classList.add('circle') createElem.dataset.top = "0" mainElem.appendChild(createElem) } </script> </body> </html>