0% found this document useful (0 votes)
5 views2 pages

Button HTML

Uploaded by

vernicykapivo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Button HTML

Uploaded by

vernicykapivo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Анимации и Треугольник</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f9;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}

h1 {
margin: 20px 0;
font-size: 24px;
color: #333;
opacity: 1;
transition: all 0.5s ease-in-out;
}

.triangle {
display: flex;
flex-direction: column;
align-items: center;
line-height: 1.2;
font-size: 18px;
white-space: pre;
font-family: monospace;
color: #007BFF;
}

button {
padding: 10px 20px;
font-size: 16px;
color: white;
background-color: #007BFF;
border: none;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease-in-out;
}

button:hover {
background-color: #0056b3;
transform: scale(1.1);
}

@keyframes colorChange {
0% { color: #007BFF; }
25% { color: #FF5733; }
50% { color: #28A745; }
75% { color: #FFC107; }
100% { color: #007BFF; }
}

.animate-color {
animation: colorChange 1s infinite;
}

@keyframes fadeOut {
0% { opacity: 1; }
100% { opacity: 0; transform: scale(0.5); }
}

.animate-fade {
animation: fadeOut 0.5s forwards;
}

@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}

.animate-bounce {
animation: bounce 0.5s ease-in-out;
}
</style>
</head>
<body>
<h1 id="main-text" class="triangle">
*
***
*****
*******
*********
</h1>
<button onclick="triggerAnimation()">Нажми меня</button>

<script>
let animations = ["animate-color", "animate-fade", "animate-bounce"];
let currentIndex = 0;

function triggerAnimation() {
const textElement = [Link]("main-text");

// Удаляем предыдущую анимацию


[Link](...animations);

// Применяем новую анимацию


const newAnimation = animations[currentIndex];
[Link](newAnimation);

// Меняем анимацию циклично


currentIndex = (currentIndex + 1) % [Link];
}
</script>
</body>
</html>

You might also like