react实现时钟翻牌效果

需求:随着数字的变动要求有时钟翻动动效

问题:只在加载时有动效

解决方案:通过判断数字改变(这里通过新旧数值变动来判断,不贴代码啦),每次变动的时候手动把animationIterationCount设置为infinite(持续动画),半秒后改为1(动画只执行一次),

特效参考代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数字翻牌效果</title>
    <style>
        body {
            margin: 0 auto;
            padding: 0;
            text-align: center;
        }
        .container {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: 908px;
            height: 150px;
            background-color: #cc3131;
            border-bottom: 5px solid #ff8b8b;
            border-radius: 12px;
        }
        .item {
            position: relative;
            margin: 8px 5px 0;
            display: inline-block;
            width: 72px;
            height: 130px;
            /*background-color: #fe4e4e;*/
            background: -webkit-linear-gradient(#a42121, #fe4e4e, #bd2a2a); /* Safari 5.1 - 6.0 */
            background: -o-linear-gradient(#a42121, #fe4e4e, #bd2a2a); /* Opera 11.1 - 12.0 */
            background: -moz-linear-gradient(#a42121, #fe4e4e, #bd2a2a); /* Firefox 3.6 - 15 */
            background: linear-gradient(#a42121, #fe4e4e, #bd2a2a); /* 标准的语法 */
            border-radius: 12px;
        }
        .under, .on {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            line-height: 130px;
            color: #FACA38;
            font-size: 80px;
            border-radius: 12px;
            overflow: hidden;
        }
        .bottom {
            position: absolute;
            left: 0;
            top: 50%;
            width: 100%;
            height: 50%;
            line-height: 0;
            overflow: hidden;    /*不加这行就不会隐藏掉上面那半个数字部分*/
            background: -webkit-linear-gradient(#fe4e4e, #bd2a2a); /* Safari 5.1 - 6.0 */
            background: -o-linear-gradient(#fe4e4e, #bd2a2a); /* Opera 11.1 - 12.0 */
            background: -moz-linear-gradient( #fe4e4e, #bd2a2a); /* Firefox 3.6 - 15 */
            background: linear-gradient(#fe4e4e, #bd2a2a); /* 标准的语法 */
        }
        .animate {
            animation-name: flip;
            animation-duration: 1s;
            animation-direction: normal;
            animation-fill-mode: forwards;
        }
        .animate1 {
            animation-delay: .3s;
            -webkit-animation-delay: .3s;
        }
        .animate2 {
            animation-delay: .6s;
        }
        .animate3 {
            animation-delay: .9s;
        }
        .animate4 {
            animation-delay: 1.2s;
        }
        .animate5 {
            animation-delay: 1.5s;
        }
        .animate6 {
            animation-delay: 1.8s;
        }
        .animate7 {
            animation-delay: 2.1s;
        }
        .animate8 {
             animation-delay: 2.4s;
         }
        .animate9 {
            animation-delay: 2.7s;
        }
        @keyframes flip{
            from {
                transform: rotateX(180deg);
                width: 100%;
            }
            to {
                transform: rotateX(0);
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="item">
            <!--底下那层-->
            <div class="under">9</div>
            <!--上面会翻动的那层-->
            <div class="on animate animate0">
                <!--只需要下面那一半-->
                <div class="bottom">9</div>
            </div>
        </div>
        <div class="item">
            <div class="under">8</div>
            <div class="on animate animate1">
                <div class="bottom">
                    <div class="num">8</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">7</div>
            <div class="on animate animate2">
                <div class="bottom">
                    <div class="num">7</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">6</div>
            <div class="on animate animate3">
                <div class="bottom">
                    <div class="num">6</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">5</div>
            <div class="on animate animate4">
                <div class="bottom">
                    <div class="num">5</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">4</div>
            <div class="on animate animate5">
                <div class="bottom">
                    <div class="num">4</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">3</div>
            <div class="on animate animate6">
                <div class="bottom">
                    <div class="num">3</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">2</div>
            <div class="on animate animate7">
                <div class="bottom">
                    <div class="num">2</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">1</div>
            <div class="on animate animate8">
                <div class="bottom">
                    <div class="num">1</div>
                </div>
            </div>
        </div>
        <div class="item">
            <div class="under">0</div>
            <div class="on animate animate9">
                <div class="bottom">
                    <div class="num">0</div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/571978.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

linux安装MySQL8.0,密码修改权限配置等常规操作详解

✨✨ 欢迎大家来到景天科技苑✨✨ &#x1f388;&#x1f388; 养成好习惯&#xff0c;先赞后看哦~&#x1f388;&#x1f388; &#x1f3c6; 作者简介&#xff1a;景天科技苑 &#x1f3c6;《头衔》&#xff1a;大厂架构师&#xff0c;华为云开发者社区专家博主&#xff0c;…

python爬虫之xpath4

1 最终项目实现的代码 仙剑 #!/usr/bin/env python ​ import logging import requests import re from urllib.parse import urljoin import pymongo import multiprocessing ​ mongo_client pymongo.MongoClient("mongodb://192.168.135.131:27017/") db mong…

短视频评论ID批量爬虫提取获客软件|视频评论下载采集工具

短视频评论批量抓取软件&#xff1a;智能拓客&#xff0c;精准抓取用户反馈 主要功能一览 1. 智能抓取任务创建&#xff1a; 软件提供了任务创建功能&#xff0c;用户只需输入任务名称、搜索关键词以及评论监控词&#xff0c;即可开始智能抓取。不仅能够搜索关键词匹配的视频…

【学习记录】autoware标定相机与激光雷达外参

一、autoware选择 这里踩了好几个坑&#xff0c;首先autoware作为一个无人驾驶知名框架&#xff0c;其内部实际上是有两套标定的东西的&#xff0c;这一点绝大多数博客没有提到。其中最常用的是一个叫标定工具箱的东西&#xff0c;这个ros包已经在1.10往后的版本中被删掉了&am…

全彩屏负氧离子监测站的使用

TH-FZ5在繁忙的都市生活中&#xff0c;我们往往忽视了一个至关重要的问题——空气质量。随着工业化的进程加速&#xff0c;空气污染已成为影响人们健康的一大隐患。为了实时监测和了解身边的空气质量&#xff0c;全彩屏负氧离子监测站应运而生&#xff0c;成为了我们守护呼吸健…

百篇博客 · 千里之行

时光荏苒流逝&#xff0c;白驹匆匆过隙&#xff0c;不知不觉间&#xff0c;Damon小智已经在CSDN上记录了第一百多篇文章。恰逢128天创作纪念日的此刻&#xff0c;我感慨良多&#xff0c;这百余篇博客不仅是我的创作历程&#xff0c;更见证了我在这五年技术生涯中走过心路历程。…

用友政务财务系统 FileDownload 任意文件读取漏洞复现

0x01 产品简介 用友政务财务系统具有多项核心功能,旨在满足各类组织的财务管理需求。首先,它提供了财务核算功能,能够全面管理企业的总账、固定资产、现金、应付应收等模块,实时掌握企业的财务状况,并通过科目管理、凭证处理、报表分析等功能为决策提供有力支持。 0x02 …

【WEEK9】 【DAY3】JSR303数据校验及多环境切换【中文版】

2024.4.24 Wednesday 目录 4.JSR303数据校验及多环境切换4.1.JSR303数据校验&#xff08;了解即可&#xff09;4.1.1.修改Person.java4.1.2.修改pom.xml&#xff08;添加依赖&#xff09;4.1.3.运行Springboot02ConfigApplicationTests.java进行测试4.1.4.使用数据校验&#x…

JavaScript系列------2

1. JS 数据类型&#xff1a; 基本数据类型&#xff1a;number数字型,string字符串型,boolean布尔型,undefined未定义型,null空类型 引用数据类型&#xff1a;object对象 js 是弱数据类型的语言&#xff0c;只有当我们赋值了才知道是什么数据类型。 声明一个变量未赋值就是 un…

智慧校园:大数据助力校情分析

随着信息技术的快速发展&#xff0c;数据信息资源以井喷的姿态涌现。数据信息的大量涌现给人们带来丰富的数据信息资源&#xff0c;但面对海量的信息资源时&#xff0c;加大了人们对有效信息资源获取的难度&#xff0c;数据挖掘技术正是这一背景下的产物&#xff0c;基于数据挖…

【安卓13】解决带GMS编译报super分区空间不足错误

1、错误信息 2、解决方案 不同供应商修改分区大小的文件路径不一样&#xff0c;但是万变不离其宗&#xff0c;根据报错信息全局搜索关键词BOARD_SUPER_PARTITION_SIZE 这里以RK供应商和AML供应商修改为例&#xff1a; &#xff08;1&#xff09;RK改法&#xff1a; 根目录下…

2024深圳杯数学建模竞赛D题(东三省数学建模竞赛D题):建立非均质音板振动模型与参数识别模型

更新完整代码和成品完整论文 《2024深圳杯&东三省数学建模思路代码成品论文》↓↓↓&#xff08;浏览器打开&#xff09; https://www.yuque.com/u42168770/qv6z0d/zx70edxvbv7rheu7?singleDoc# 2024深圳杯数学建模竞赛D题&#xff08;东三省数学建模竞赛D题&#xff0…

构建高效智能的理赔业务系统:保险科技的未来

随着保险行业的发展和科技的不断进步&#xff0c;理赔业务作为保险服务的重要环节&#xff0c;也在不断演进和改进。传统的理赔流程可能存在效率低下、信息不透明等问题&#xff0c;而现代化的理赔业务系统则能够通过数字化、智能化等手段提升理赔服务的质量和效率&#xff0c;…

【机器学习】朴素贝叶斯解决实际问题

之前写过这样一道题&#xff1a; 现在换成使用朴素贝叶斯解决这个问题 首先先了解一下朴素贝叶斯 这是之前课本里的笔记记录&#xff1a; 【机器学习笔记】朴素贝叶斯&#xff08;从先验分布到后验分布&#xff09;-CSDN博客 简单的讲解一下这道题需要的知识点 朴素贝叶斯是…

【ensp】网关冗余vrrp实验

备战中级网络工程师 目录 vrrp&#xff08;虚拟路由冗余技术&#xff09; 为什么会出现vrrp&#xff1f; 两个角色 选举流程 基本原理 VRRP 的两个定时器 VRRP 的主备切换 主备切换的条件 VRRP 主备回切 认证方式 冗余路由器 冗余核心交换机 vrrp&#xff08;虚拟路…

【04-提升模型性能:集成学习与超参数优化】

文章目录 前言集成学习BaggingBoosting超参数优化随机搜索贝叶斯优化总结前言 在前几篇博文中,我们已经介绍了一些机器学习的基础知识、Scikit-learn的核心工具与技巧,以及如何评估模型性能。本篇博文将重点讲解两个可以显著提升机器学习模型性能的高级策略:集成学习和超参数…

Github 2024-04-25Go开源项目日报Top10

根据Github Trendings的统计,今日(2024-04-25统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量Go项目10Vue项目1Go编程语言:构建简单、可靠和高效的软件 创建周期:3474 天开发语言:Go协议类型:BSD 3-Clause “New” or “Revised” Lic…

基于spark进行数据分析的心力衰竭可视化大屏项目

基于spark进行数据分析的心力衰竭可视化大屏项目 项目背景 在当今的医疗领域&#xff0c;数据驱动的决策变得日益重要。心力衰竭作为常见的心血管疾病&#xff0c;其临床数据的分析对于改善患者治疗结果至关重要。本文将介绍如何利用Apache Spark进行大规模心力衰竭临床数据的…

浅谈免杀下的持久化

文章目录 前记注册表计划任务COM劫持后记reference 前记 实战中持久化的手段常用的就是加服务、添改注册表、加计划任务、劫持等&#xff0c;这里探索c/c下的维权免杀 注册表 用户级 \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run \HKEY_CURRENT_USER…

正则表达式.java

正则表达式的作用&#xff1a; ①可以校验字符串是否满足一定的规则&#xff0c;并用来校验数据格式的合法性&#x1f9f8; &#x1f9e9;[]:只能是括号里的字符 &#x1f9e9;[^]&#xff1a;除了括号里的字符 &#x1f9e9;[- -]:表示两段范围&#xff0c;满足其一即可 &a…