当前位置:网站首页>Digital scroll strip animation
Digital scroll strip animation
2022-07-02 19:18:00 【a ٩ (๑ ʊ Begin with ʃʃʃ bustling ʊ ๑) ۶ a】
The premise of digital scrolling is that the number changes in real time
Parent component
<Num width="19px" height="45px" color="#11ffc5" :val="numCount" />
this.interval = setInterval(() => {
this.numCount = +this.numCount + Math.floor(Math.random() * 5);
}, 5000);
beforeDestroy() {
clearInterval(this.interval);
},
Parent component
<template>
<div class="count-flop" :key="compKey" :style="{ height: height }">
<div
:class="item != '.' ? 'count-flop-box' : 'count-flop-point'"
v-for="(item, index) in value"
:key="index"
:style="{ width: width, color: color }"
>
<div
v-if="item != '.'"
class="count-flop-content"
:class="['rolling_' + item]"
>
<div v-for="(item2, index2) in numberList" :key="index2">
{
{
item2 }}
</div>
</div>
<div v-else class="count-flop-content">.</div>
</div>
<div v-if="suffix" class="count-flop-unit">{
{
suffix }}</div>
</div>
</template>
<script>
export default {
data() {
return {
value: [],
numberList: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
compKey: 0,
};
},
props: ["val", "suffix", "width", "height", "color"],
watch: {
val() {
this.value = this.val.toString().split("");
this.compKey += 1;
},
},
created() {
this.value = this.val.toString().split("");
},
};
</script>
<style scoped>
.count-flop {
display: inline-block;
/* font-size: 0; */
/* Changeable */
}
.count-flop > div {
position: relative;
display: inline-block;
overflow: hidden;
height: 100%;
}
.count-flop-box {
/* Changeable */
width: 18px;
border-radius: 6px;
/* font-size: 32px; */
}
.count-flop-point {
/* Changeable */
margin-right: 5px;
width: 10px;
}
.count-flop-content {
font-family: MicrosoftYaHei-Bold;
text-align: center;
position: absolute;
left: 0;
top: 0;
width: 100%;
animation-fill-mode: forwards !important;
}
.rolling_0 {
animation: rolling_0 2.1s ease;
}
@keyframes rolling_0 {
from {
transform: translateY(-90%);
}
to {
transform: translateY(0);
}
}
.rolling_1 {
animation: rolling_1 3s ease;
}
@keyframes rolling_1 {
from {
transform: translateY(0);
}
to {
transform: translateY(-10%);
}
}
.rolling_2 {
animation: rolling_2 2.1s ease;
}
@keyframes rolling_2 {
from {
transform: translateY(0);
}
to {
transform: translateY(-20%);
}
}
.rolling_3 {
animation: rolling_3 3s ease;
}
@keyframes rolling_3 {
from {
transform: translateY(0);
}
to {
transform: translateY(-30%);
}
}
.rolling_4 {
animation: rolling_4 2.1s ease;
}
@keyframes rolling_4 {
from {
transform: translateY(0);
}
to {
transform: translateY(-40%);
}
}
.rolling_5 {
animation: rolling_5 3s ease;
}
@keyframes rolling_5 {
from {
transform: translateY(0);
}
to {
transform: translateY(-50%);
}
}
.rolling_6 {
animation: rolling_6 2.1s ease;
}
@keyframes rolling_6 {
from {
transform: translateY(0);
}
to {
transform: translateY(-60%);
}
}
.rolling_7 {
animation: rolling_7 3.1s ease;
}
@keyframes rolling_7 {
from {
transform: translateY(0);
}
to {
transform: translateY(-70%);
}
}
.rolling_8 {
animation: rolling_8 2.1s ease;
}
@keyframes rolling_8 {
from {
transform: translateY(0);
}
to {
transform: translateY(-80%);
}
}
.rolling_9 {
animation: rolling_9 3.6s ease;
}
@keyframes rolling_9 {
from {
transform: translateY(0);
}
to {
transform: translateY(-90%);
}
}
</style>
边栏推荐
- Markdown基础语法
- Novice must see, click two buttons to switch to different content
- 2022软件工程期末考试 回忆版
- R语言dplyr包rowwise函数、mutate函数计算dataframe数据中多个数据列在每行的最大值、并生成行最大值对应的数据列(row maximum)
- Learning summary of MySQL advanced 6: concept and understanding of index, detailed explanation of b+ tree generation process, comparison between MyISAM and InnoDB
- yolov3 训练自己的数据集之生成train.txt
- Codeworks 5 questions per day (1700 average) - day 4
- golang:[]byte转string
- In pytorch function__ call__ And forward functions
- FastDFS安装
猜你喜欢

潇洒郎:彻底解决Markdown图片问题——无需上传图片——无需网络——转发给他人图片无缺失

MySQL advanced learning summary 8: overview of InnoDB data storage structure page, internal structure of page, row format

云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统

线程应用实例

Tips for material UV masking

新手必看,點擊兩個按鈕切換至不同的內容

Excel如何进行隔行复制粘贴

新手必看,点击两个按钮切换至不同的内容

Thread application instance

论文导读 | 机器学习在数据库基数估计中的应用
随机推荐
横向越权与纵向越权[通俗易懂]
PyTorch函数中的__call__和forward函数
[test development] software testing - concept
Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统
[fluent] dart data type (VaR data type | object data type)
使用 Cheat Engine 修改 Kingdom Rush 中的金钱、生命、星
Juypter notebook modify the default open folder and default browser
数据降维——因子分析
Kubernetes three open interfaces first sight
R language uses Cox of epidisplay package Display function obtains the summary statistical information of Cox regression model (risk rate HR, adjusted risk rate and its confidence interval, P value of
【测试开发】软件测试—概念篇
中国信通院《数据安全产品与服务图谱》,美创科技实现四大板块全覆盖
Processing strategy of message queue message loss and repeated message sending
高级性能测试系列《24. 通过jdbc执行sql脚本》
The mybatieshelperpro tool can be generated to the corresponding project folder if necessary
全链路数字化转型下,零售企业如何打开第二增长曲线
【JVM调优实战100例】02——虚拟机栈与本地方法栈调优五例
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
Transformation of thinking consciousness is the key to the success or failure of digital transformation of construction enterprises