当前位置:网站首页>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>
边栏推荐
- yolov3 训练自己的数据集之生成train.txt
- Thread application instance
- Talk about the design of red envelope activities in e-commerce system
- 新手必看,點擊兩個按鈕切換至不同的內容
- Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
- QT中的QPropertyAnimation使用和toast案列
- [daily question] first day
- 【测试开发】一文带你了解什么是软件测试
- M2dgr: slam data set of multi-source and multi scene ground robot (ICRA 2022)
- What is 9D movie like? (+ common sense of dimension space)
猜你喜欢
Obligatoire pour les débutants, cliquez sur deux boutons pour passer à un contenu différent
Juypter notebook modify the default open folder and default browser
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
PHP-Parser羽毛球预约小程序开发require线上系统
MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree
Deep learning mathematics foundation
juypter notebook 修改默认打开文件夹以及默认浏览器
[0701] [论文阅读] Alleviating Data Imbalance Issue with Perturbed Input During Inference
codeforces每日5题(均1700)-第四天
高频面试题
随机推荐
SIFT特征点提取「建议收藏」
数据降维——因子分析
The difference between interceptor and filter
Obligatoire pour les débutants, cliquez sur deux boutons pour passer à un contenu différent
2022.7.1-----leetcode.241
为什么要做企业固定资产管理系统,企业如何加强固定资产管理
The R language dplyr package rowwise function and mutate function calculate the maximum value of multiple data columns in each row in the dataframe data, and generate the data column (row maximum) cor
Compile oglpg-9th-edition source code with clion
虚拟机初始化脚本, 虚拟机相互免秘钥
PyTorch函数中的__call__和forward函数
Qpropertyanimation use and toast case list in QT
Imitation Jingdong magnifying glass effect (pink teacher version)
仿京东放大镜效果(pink老师版)
全链路数字化转型下,零售企业如何打开第二增长曲线
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
In pytorch function__ call__ And forward functions
Have you stepped on the nine common pits in the e-commerce system?
How to play when you travel to Bangkok for the first time? Please keep this money saving strategy
Golang并发编程——goroutine、channel、sync
C文件输入操作