效果
案例一:上下滚动
案例二:本身变化
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>数字滚动变化动画</title>
</head>
<style>
*{
margin:0;
padding: 0;
}
/* 滚动变化相关 */
.valScrollAmt-box {
display: flex;
height: 50px;
overflow: hidden;
font-size: 50px;
font-weight: bold;
line-height:50px;
margin: 10px 10px;
}
.digit-container {
display: flex;
flex-direction: column;
line-height: 50px;
}
/* 动态变化 */
.valChangeAmt-box {
font-size: 50px;
font-weight: bold;
lin