1 Star 0 Fork 0

sometime/css酷酷

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Infinite Scrolling Animation.html 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
wangbing 提交于 2024-04-08 15:18 . add
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infinite Scrolling Animation</title>
<!-- <link rel="stylesheet" href="./css/index.css"> -->
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
min-height: 100vh;
background-color: #222;
color: #fff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.scroll {
display: flex;
width: 700px;
overflow: hidden;
mask-image: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent);
-webkit-mask-image: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent);
}
.scroll > div {
white-space: nowrap;
animation: animate var(--t) linear infinite;
animation-delay: calc(var(--t) * -1);
text-align: center;
}
.scroll>div>div {
width: 300px;
padding: 20px;
background-color: cy;
}
@keyframes animate {
0% {
transform: translateY(100%);
}
100% {
transform: translateY(-100%);
}
}
.scroll > div:nth-child(2) {
animation: animate2 var(--t) linear infinite;
animation-delay: calc(var(--t) / -2);
}
.scroll > div:nth-child(2) div {
/* background-color: red; */
}
@keyframes animate2 {
0% {
transform: translate(-100%,100%);
}
100% {
transform: translate(-100%,-100%);
}
}
.scroll:hover > div {
animation-play-state: paused;
}
</style>
</head>
<body>
<div class="scroll" style="--t: 20s">
<div>
<div>HTML</div>
<div>CSS</div>
<div>JavaScript</div>
<div>Vue</div>
<div>React</div>
<div>Figma</div>
<div>Photoshop</div>
<div>Photoshop2</div>
</div>
<div>
<div>HTML</div>
<div>CSS</div>
<div>JavaScript</div>
<div>Vue</div>
<div>React</div>
<div>Figma</div>
<div>Photoshop</div>
<div>Photoshop2</div>
</div>
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yezhu219_admin/css-cool.git
[email protected]:yezhu219_admin/css-cool.git
yezhu219_admin
css-cool
css酷酷
master

搜索帮助