Calculator Tools Calculator Tools
Create

Waving Flag

Nov 16, 2023

About this app

A fun and colorful single page web app displaying a waving flag.

Waving Flag 🏳️ Click the flag to change its color!

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Waving Flag</title>
<meta name="description" content="A fun and colorful single page web app displaying a waving flag.">
<meta name="keywords" content="flag, waving, color, fun, web app">

<link href="https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap" rel="stylesheet">

<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("flag").addEventListener("click", function() {
var colors = ["🟥", "🟧", "🟨", "🟩", "🟦", "🟪"];
var randomColor = colors[Math.floor(Math.random()*colors.length)];
document.getElementById("flag").textContent = randomColor;
});
});
} catch (error) {
throw error;
}
</script>

<style>
body {
background: linear-gradient(to right, #12c2e9, #c471ed, #f64f59);
font-family: 'Patrick Hand', cursive;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
color: white;
text-align: center;
background-size: 400% 400%;
animation: Gradient 15s ease infinite;
}

#flag {
font-size: 10rem;
cursor: pointer;
animation: wave 1s infinite;
}

@keyframes wave {
0%, 100% { transform: rotate(0deg); }
50% { transform: rotate(20deg); }
}

@keyframes Gradient {
0% { background-position: 0% 50% }
50% { background-position: 100% 50% }
100% { background-position: 0% 50% }
}
</style>
</head>
<body>
<div id="main-container" class="container">
<span id="flag">🏳️</span>
<p>Click the flag to change its color!</p>
</div>
</body>
</html>