js模拟蛇爬行运动效果
代码语言:html
所属分类:动画
代码描述:js模拟蛇爬行运动效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
html,
body {
height: 100%;
}
body {
background-color: #37444F;
font-family: 'Oxygen', sans-serif;
line-height: 2rem;
}
a {
color: #F65A5B;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
canvas {
display: block;
}
body {
word-wrap: break-word;
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80vw;
max-width: 100%;
height: 30vh;
max-height: 100%;
background-color: rgba(255,255,255,1);
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
z-index: 1010;
font-size: calc(1rem + 1vw);
padding: 3rem 4rem;
}
.modal-overlay {
z-index: 1000;
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.modal button {
background-color: #34B3A0;
border: none;
display: block;
width: 100%;
margin-top: 2rem;
padding: 1.5rem 2.5rem;
color: white;
font-size: calc(0.9rem + 1vw);
font-weight: 300;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 0.05rem;
animation-name: lantern;
animation-duration: 3s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-play-state: running;
}
.text {
font: 16px/300px 'Lato', sans-serif;
width: 300px;
height: 300px;
position: absolute;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
user-select: none;
}
.click-explosion {
width: 50px;
height: 50px;
animation: click-explode 1s ease-out forwards;
position: absolute;
z-index: 400;
}
.click-explosion-right {
width: 50px;
height: 50px;
border-radius: 50px;
background: #f00;
animation: click-explode 1s ease-out forwards;
position: absolute;
z-index: 400;
}
@keyframes click-explode {
100% {
transform: scale(1.5);
opacity: 0;
}
}
@keyframes lantern {
from {
background-color: #34B3A0;
}
50% {
background-color: HSL(171, 55%, 30%);
}
to {
background-color: #34B3A0;
}
}
</style>
</head>
<body translate="no">
<canvas id="c"></canvas>
<div class="modal-overlay" id="modal-overlay"></div>
<script>
$(document).ready(function() {
$('.modal button').click(function() {
$('div.modal').remove();
$('div.modal-overlay').remove();
});
});
</script>
<script>
const a = document.getElementById(.........完整代码请登录后点击上方下载按钮下载查看
网友评论0