当前位置:网站首页>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>
边栏推荐
- 2022 software engineering final exam recall Edition
- Progress-进度条
- mysql备份后缀是什么_mysql备份还原
- 页面标题组件
- 教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
- Crypto usage in nodejs
- Compile oglpg-9th-edition source code with clion
- 医院在线问诊源码 医院视频问诊源码 医院小程序源码
- 横向越权与纵向越权[通俗易懂]
- Codeworks 5 questions per day (1700 average) - day 4
猜你喜欢

Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management

MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree

新手必看,点击两个按钮切换至不同的内容
![[daily question] the next day](/img/8a/18329bd9b4a3a4445c8fbbc1ce562b.png)
[daily question] the next day

How can retail enterprises open the second growth curve under the full link digital transformation

Thread application instance

Excel查找一列中的相同值,删除该行或替换为空值

M2dgr: slam data set of multi-source and multi scene ground robot (ICRA 2022)

Markdown基础语法

论文导读 | 关于将预训练语言模型作为知识库的分析与批评
随机推荐
R language ggplot2 visual Facet: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
codeforces每日5题(均1700)-第四天
R language ggplot2 visualization: visualize the line chart and add customized X-axis label information to the line chart using labs function
[0701] [论文阅读] Alleviating Data Imbalance Issue with Perturbed Input During Inference
Progress progress bar
R language uses lrtest function of epidisplay package to perform likelihood ratio test on multiple GLM models (logisti regression). Compare whether the performance of the two models is different, and
思维意识转变是施工企业数字化转型成败的关键
Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
Codeworks 5 questions per day (1700 average) - day 4
2022.7.1-----leetcode.241
Stm32g0 USB DFU upgrade verification error -2
Markdown basic grammar
新手必看,点击两个按钮切换至不同的内容
消息队列消息丢失和消息重复发送的处理策略
Binary operation
Learning summary of MySQL advanced 6: concept and understanding of index, detailed explanation of b+ tree generation process, comparison between MyISAM and InnoDB
How to copy and paste interlaced in Excel
STM32G0 USB DFU 升级校验出错-2
[fluent] dart data type (VaR data type | object data type)
ORA-01455: converting column overflows integer datatype