<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta tags and title -->
</head>
<body>
<h1>Spiral Matrix Animation</h1>
<!-- Matrix container and control buttons -->
<div id="matrix-container"></div>
<div class="controls">
<button class="btn" id="start-btn">Start</button>
<button class="btn" id="reset-btn">Reset</button>
</div>
<script>
// JavaScript functions for matrix animation
</script>
</body>
</html>
- Body style:
- Flex container with column direction, aligning items and justifying content at the center.
- Full viewport height.
- No margins.
- .matrix class style:
- Flex container with column direction, center alignment, rounded border, and shadow.
- Initially hidden.
- .has-animation .cell class style:
- Transition property for background-color over 1 second.
- .row class style:
- Flex container.
- .cell class style:
- Square-shaped cells with border, centered content, bold text, rounded corners, and spacing.
- .controls class style:
- Margin-top of 20px.
- Flex container with a gap of 20px.
- .btn class style:
- Rounded button with shadow, color transition, padding, font size, background, and cursor pointer.
- Hover effect for background color change.
const cells = [];
let animationInterval;
let cellIndex = 0;
const matrixContainer = document.getElementById('matrix-container');
function initializeMatrix() {
// Function to initialize the matrix with user-defined rows and columns
}
function generateMatrix(rows, cols) {
// Function to generate matrix cells based on rows and columns
}
function renderMatrix() {
// Function to render the matrix
}
function startAnimation() {
// Function to start the animation
}
function animateSpiral() {
// Function to animate in spiral order
}
function resetAnimation() {
// Function to reset the animation
}
function getMatrixSpiralOrder(matrix) {
// Function to get the spiral order of the matrix
}
function getRandomColor() {
// Function to generate a random color
}