Animal Party
Dancing Animals!
HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<link rel="icon" href="icon.png">
<title>AnimalParty</title>
</head>
<body>
<img id="hamstergif" src="https://i.imgur.com/VcCu1wC.gif" alt="Hamster Dance">
<table id="table">
<tr>
<td id="td1"></td>
<td id="td2"></td>
<td id="td3"></td>
<td id="td4"></td>
<td id="td5"></td>
<td id="td6"></td>
<td id="td7"></td>
<td id="td8"></td>
</tr>
<tr>
<td id="td9"></td>
<td id="td10"></td>
<td id="td11"></td>
<td id="td12"></td>
<td id="td13"></td>
<td id="td14"></td>
<td id="td15"></td>
<td id="td16"></td>
</tr>
<tr>
<td id="td17"></td>
<td id="td18"></td>
<td id="td19"></td>
<td id="td20"></td>
<td id="td21"></td>
<td id="td22"></td>
<td id="td23"></td>
<td id="td24"></td>
</tr>
<tr>
<td id="td25"></td>
<td id="td26"></td>
<td id="td27"></td>
<td id="td28"></td>
<td id="td29"></td>
<td id="td30"></td>
<td id="td31"></td>
<td id="td32"></td>
</tr>
<tr>
<td id="td33"></td>
<td id="td34"></td>
<td id="td35"></td>
<td id="td36"></td>
<td id="td37"></td>
<td id="td38"></td>
<td id="td39"></td>
<td id="td40"></td>
</tr>
<tr>
<td id="td41"></td>
<td id="td42"></td>
<td id="td43"></td>
<td id="td44"></td>
<td id="td45"></td>
<td id="td46"></td>
<td id="td47"></td>
<td id="td48"></td>
</tr>
</table>
<div id="container">
<input id="beargif" width:48px; height="48px"; type="image" src="https://media2.giphy.com/media/1dIWQ3G8RQHFwSZ3wi/200w.gif?cid=82a1493bd2beuibpv5i7w0fv5q2an3y7ctvj8skqif8z3fhn&rid=200w.gif&ct=s" alt="Bear Dance">
<input id="duckgif" width:48px; height="48px"; type="image" src="https://c.tenor.com/3arJZZkFW6kAAAAi/dancing-duck-danse.gif">
...
CSS
html {
max-width: 254px;
}
#hamstergif {
position: absolute;
width: 48px;
height: 48px;
}
#beargif, duckgif, cowgif, pandagif {
position: relative;
}
#container {
max-width: 234px;
}
#button {
width: 234px;
height: 48px;
}
td {
height:25px;
width:25px
}
JavaScript
function Disco(){
for (i=1; i<=48;i++) {
var randomColor = '#'+Math.floor(Math.random()*16777215).toString(16);
document.getElementById("td"+i+"").style.backgroundColor = randomColor;
}
}
function ResetColor(){
var randomColor = "hsl(" + 360 * Math.random() + ',' +(25 + 70 * Math.random()) + '%,' + (85 + 10 * Math.random()) + '%)'
document.getElementById("button").style.backgroundColor = randomColor;
}
function HamsterPos() {
let left = (Math.floor(Math.random() * (190 - 10 + 1) + 10))
let top1 = (Math.floor(Math.random() * (130 - 10 + 1) + 10))
document.getElementById('hamstergif').style="position:absolute; left:"+left+"px; top:"+top1+"px;";
}
function BearPos() {
let left = (Math.floor(Math.random() * (190 - 10 + 1) + 10))
let top1 = (Math.floor(Math.random() * (130 - 10 + 1) + 10))
document.getElementById('beargif').style="position:absolute; left:"+left+"px; top:"+top1+"px;";
}
function DuckPos() {
let left = (Math.floor(Math.random() * (190 - 10 + 1) + 10))
let top1 = (Math.floor(Math.random() * (130 - 10 + 1) + 10))
document.getElementById('duckgif').style="position:absolute; left:"+left+"px; top:"+top1+"px;";
}
function CowPos() {
let left = (Math.floor(Math.random() * (190 - 10 + 1) + 10))
let top1 = (Math.floor(Math.random() * (130 - 10 + 1) + 10))
document.getElementById('cowgif').style="position:absolute; left:"+left+"px; top:"+top1+"px;";
}
function PandaPos() {
let left = (Math.floor(Math.random() * (190 - 10 + 1) + 10))
let top1 = (Math.floor(Math.random() * (130 - 10 + 1) + 10))
document.getElementById('pandagif').style="position:absolute; left:"+left+"px; top:"+top1+"px;";
}
ResetColor();
HamsterPos();
Disco();
setInterval("Disco();", 750);
setInterval("ResetColor();", 750);
setInterval("HamsterPos();", 2000);
document.getElementById("button").onclick = function() {ButtonFunc()};
function ButtonFunc() {
window.location.reload();
}
document.getElementById("beargif").onclick =...