html - CSS将文本旋转到垂直并从下到上滚动无限动画
问题描述
我想先像这样旋转文本,然后从下到上无限滚动,我已经检查了CSS animate scrolling text using text-indent 之类的答案,有人可以帮忙吗?提前致谢。
我发现英文字符的行为与writing-mode
中文字符的行为不同。
writing-mode: vertical-lr;
更新
感谢@ulou,我更改了他发布的代码。最初的问题没有描述清楚。我删除了动画旋转 0 到旋转 90。
.container {
width: 100%;
height: 100vh;
background-color: black;
color: white;
display: flex;
justify-content: center;
}
.cool-text {
align-self: center;
animation: 4s coolAnimation infinite;
font-size: 100px;
white-space: nowrap;
}
@keyframes coolAnimation {
0% {
transform: rotate(90deg);
}
100% {
transform: rotate(90deg) translateX(-100vh);
}
}
<div class="container">
<div class="cool-text">我來试一下效果怎么样</div>
</div>
我只需要从下到上的无限动画,下面是我的代码
动画。您会看到padding-left: 100vh
,我还需要在新帧开始之前在前一帧中消失所有文本,例如循环文本或循环播放。
body {
background: black;
}
.main-nav {
color: white;
font-size: 50vw;
text-align: center;
white-space: nowrap;
height: 100vw;
line-height: 100vw;
transform: rotate(90deg) translateY(-100%);
transform-origin: left top;
width: 100vh;
padding-left: 100vh;
}
<div class="main-nav">
我来试试效果哈哈哈哈
</div>
解决方案
.container {
width: 100%;
height: 95vh;
background-color: black;
color: white;
display: flex;
justify-content: center;
}
.cool-text {
align-self: center;
font-size: 100px;
transform: rotate(90deg);
animation: 6s coolAnimation infinite;
animation-timing-function: linear;
white-space: nowrap;
width: 100%;
}
@keyframes coolAnimation {
0% {
transform: rotate(90deg) translateX(300vh);
}
100% {
transform: rotate(90deg) translateX(-300vh);
}
}
<div class="container">
<div class="cool-text">Cool animated text</div>
</div>
推荐阅读
- r - 如何构造 for 和 if 循环来构造拉丁方格?
- microsoft-graph-api - Microsoft Graph API OneNote 页面内容 BadRequest
- python - 非常简单的字符串加密
- r - 如果 rows 具有相似的元素,则保留较短的行
- python - 类中的Python模拟迭代器函数
- python - 如何从数据框中删除具有空值和分类变量的行?
- html - 如何不将border-right应用于div-CSS的最后一个孩子
- javascript - 我无法让 $set 运算符在特定字段上工作
- javascript - 使用 cdn 工作正常,但使用 nodejs 不起作用
- python-3.x - 在 python 中将音频从 .m4a 转换为 .wav