MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createInsect

Function createInsect

assets/js/InsectCatch.js:39–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39function createInsect() {
40 const insect = document.createElement('div')
41 insect.classList.add('insect')
42 const { x, y } = getRandomLocation()
43 insect.style.top = `${y}px`
44 insect.style.left = `${x}px`
45 insect.innerHTML = `<img src="${selected_insect.src}" alt="${selected_insect.alt}" style="transform: rotate(${Math.random() * 360}deg)" />`
46
47 insect.addEventListener('click', catchInsect)
48
49 game_container.appendChild(insect)
50}
51
52function getRandomLocation() {
53 const width = window.innerWidth

Callers

nothing calls this directly

Calls 1

getRandomLocationFunction · 0.85

Tested by

no test coverage detected