88 Key Piano
by Jonno Kennedy
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>88-Key Realistic Piano</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.26/Tone.js"></script>
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #1e5799, #2989d8, #207cca, #7db9e8);
font-family: Arial, sans-serif;
overflow: hidden;
}
.piano-container {
width: 100%;
max-width: 1200px;
overflow-x: auto;
padding: 20px;
box-sizing: border-box;
}
.piano {
display: flex;
position: relative;
background: #333;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 50px rgba(0,0,0,0.5);
margin: 0 auto;
}
.key {
height: 200px;
width: 30px;
border: 1px solid #000;
box-sizing: border-box;
cursor: pointer;
position: relative;
transition: all 0.1s ease;
}
.white {
background: linear-gradient(to bottom, #fff 0%, #eee 100%);
border-radius: 0 0 5px 5px;
z-index: 1;
}
.black {
background: linear-gradient(to bottom, #000 0%, #333 100%);
height: 120px;
width: 20px;
margin: 0 -10px;
z-index: 2;
border-radius: 0 0 3px 3px;
}
.key:active, .key.active {
transform: translateY(4px);
box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.white:active, .white.active {
background: linear-gradient(to bottom, #eee 0%, #ddd 100%);
}
...