-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #492 from Facug03/codes
Añadir MiduCode al componente KonamiCode
- Loading branch information
Showing
5 changed files
with
102 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
interface Contributor { | ||
avatar_url: string | ||
login: string | ||
} | ||
|
||
export async function showContributors($miduContainer: HTMLDivElement) { | ||
const url = "https://api.github.com/repos/midudev/la-velada-web-oficial/contributors" | ||
|
||
const response = await fetch(url) | ||
const contributors = (await response.json()) as Contributor[] | ||
|
||
for (let i = 0; i < contributors.length; i++) { | ||
setTimeout(() => { | ||
const { avatar_url, login } = contributors[i] | ||
const img = document.createElement("img") | ||
img.src = avatar_url | ||
img.alt = login | ||
img.title = login | ||
img.classList.add("bubbles") | ||
if (login === "midudev") { | ||
img.setAttribute("id", "midu") | ||
} else { | ||
img.style.left = `${generateRandomNumber()}vw` | ||
const startRotation = Math.floor(Math.random() * (90 - -90 + 1)) + -45 | ||
img.style.transform = `rotate(${startRotation}deg)` | ||
} | ||
img.addEventListener("animationend", () => { | ||
$miduContainer.removeChild(img) | ||
}) | ||
$miduContainer.appendChild(img) | ||
}, i * 300) | ||
} | ||
} | ||
|
||
export function checkAndRemoveContainer($miduContainer: HTMLDivElement) { | ||
if ($miduContainer.childElementCount === 0) { | ||
$miduContainer.remove() | ||
return | ||
} | ||
|
||
setTimeout(() => { | ||
checkAndRemoveContainer($miduContainer) | ||
}, 1000) | ||
} | ||
|
||
function generateRandomNumber() { | ||
return Math.floor(Math.random() * 91) + 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters