当前位置:网站首页>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>
边栏推荐
- R语言dplyr包rowwise函数、mutate函数计算dataframe数据中多个数据列在每行的最大值、并生成行最大值对应的数据列(row maximum)
- 【ERP软件】ERP体系二次开发有哪些危险?
- 全链路数字化转型下,零售企业如何打开第二增长曲线
- Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
- How can retail enterprises open the second growth curve under the full link digital transformation
- Processing strategy of message queue message loss and repeated message sending
- FastDFS安装
- Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
- ICDE 2023|TKDE Poster Session(CFP)
- 以太网PHY层芯片LAN8720A简介
猜你喜欢
![[100 cases of JVM tuning practice] 03 -- four cases of JVM heap tuning](/img/54/8a18cd30e6186528599c0556b1ee3b.png)
[100 cases of JVM tuning practice] 03 -- four cases of JVM heap tuning

High frequency interview questions

Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径

How to copy and paste interlaced in Excel

juypter notebook 修改默认打开文件夹以及默认浏览器

Processing strategy of message queue message loss and repeated message sending

Codeworks 5 questions per day (1700 average) - day 4

Yolov3 trains its own data set to generate train txt

机器学习笔记 - 时间序列预测研究:法国香槟的月销量

Thread application instance
随机推荐
Masa framework - DDD design (1)
Progress progress bar
Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
High frequency interview questions
Markdown基础语法
codeforces每日5题(均1700)-第四天
论文导读 | 机器学习在数据库基数估计中的应用
juypter notebook 修改默认打开文件夹以及默认浏览器
数据降维——主成分分析
Golang concurrent programming goroutine, channel, sync
SIFT特征点提取「建议收藏」
R语言使用epiDisplay包的lrtest函数对多个glm模型(logisti回归)执行似然比检验(Likelihood ratio test)对比两个模型的性能是否有差异、广义线性模型的似然比检
metric_logger小解
golang:[]byte转string
Obligatoire pour les débutants, cliquez sur deux boutons pour passer à un contenu différent
R language ggplot2 visual Facet: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
[0701] [paper reading] allowing data imbalance issue with perforated input during influence
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
Date tool class (updated from time to time)
移动机器人路径规划:人工势场法[通俗易懂]