当前位置:网站首页>Charging effect simulation
Charging effect simulation
2022-07-31 01:39:00 【Gai Yuexi's boyfriend outside the circle (섭소우)】
Table of Contents
Thought analysis and code implementation
Demand
Continue to fish...
On a whim, how to achieve a mobile phone charging effect?Similar to...emmm is not easy to find, so omitted.In short, the dynamic effect that appears on the interface after the phone is connected to the charger.
Thought analysis and code implementation
This can obviously also be achieved with css animations.Displays the current battery level with a circle surrounded by solid-colored areas that are changing in color and shape.
It's not very easy to describe, just go to the code.
html section
82.5%
css section
.container {width: 500px;min-height: 600px;background-color: black;margin: 0 auto;position: relative;}.circle {width: 300px;height: 300px;border-radius: 50%;margin: 100px auto;border: 3px solid white;color: white;background-color: black;line-height: 300px;text-align: center;font-size: 50px;position: relative;}/* clear margin overlap */.clearfix::before,.clearfix::after {content: '';display: table;clear: both;}.fire {width: 350px;height: 320px;position: absolute;top: calc(50% - 50px);left: 50%;transform: translate(-50%, -50%);}.fire-content{width: 100%;height: 100%;animation: rotate 10s infinite both reverse linear;}@keyframes rotate{from{transform: rotate(0);background-color: azure;border-radius: 260px 80px;}25%{transform: rotate(90deg);background-color: beige;border-radius: 80px 260px;}50%{transform: rotate(180deg);background-color: bisque;border-radius: 260px 80px;}75%{transform: rotate(270deg);background-color: powderblue;border-radius: 80px 260px;}100%{transform: rotate(360deg);background-color: honeydew;border-radius: 260px 80px;}}
It's important to note here that confusion can arise when transform and animation are applied to the same element, and the animation also manipulates the transform.To do this, you can wrap a parent element outside the element, transform the parent element, and animate the child element.This way, there will be no confusion.
So, I manipulate fire-content with animation and fire with transform.
Achieving the effect
It's kind of like that!
Summary
This time the code is relatively simple, nothing special, just a point to pay attention to when applying animations and transforms.
When publishing, it indicates that the quality of the article is too low....Hey, let's go low!
边栏推荐
- Chi-square distribution of digital image steganography
- TiCDC 架构和数据同步链路解析
- 【952. Calculate the maximum component size according to the common factor】
- Distributed. Distributed lock
- 35. 反转链表
- Multiplication, DFS order
- TiDB之rawkv升级之路v5.0.4-->v6.1.0
- Dispatch Center xxl-Job
- 一个无经验的大学毕业生,可以转行做软件测试吗?我的真实案例
- 想要写出好的测试用例,先要学会测试设计
猜你喜欢
MySQL (6)
C语言_结构体指针数组函数选票系统
leetcode-399:除法求值
解析云原生消息流系统 Apache Pulsar 能力及场景
《实战》基于电商领域的词性提取及其决策树模型建模
case语句的综合结果,你究竟会了吗?【Verilog高级教程】
The Meta Metaverse Division lost 2.8 billion in the second quarter, still want to continue to bet?Metaverse development has yet to see a way out
VS warning LNK4099:未找到 PDB 的解决方案
Mysql:Invalid default value for TIMESTAMP
Installation problem corresponding to tensorflow and GPU version
随机推荐
Jetpack Compose学习(8)——State及remeber
《云原生的本手、妙手和俗手》——2022全国新高考I卷作文
[WeChat applet] This article takes you to understand data binding, event binding, event parameter transfer, and data synchronization
观察者(observer)模式(一)
计算S=a+aa+…+aa…a
MySql installation and configuration super detailed tutorial and simple method of building database and table
Analyze the capabilities and scenarios of the cloud native message flow system Apache Pulsar
想要写出好的测试用例,先要学会测试设计
uniapp使用第三方字体
数字图像隐写术之JPEG 隐写分析
MySql的初识感悟,以及sql语句中的DDL和DML和DQL的基本语法
ROS Action通信
MySQL (6)
孩子的编程启蒙好伙伴,自己动手打造小世界,长毛象教育AI百变编程积木套件上手
软件测试要达到一个什么水平才能找到一份9K的工作?
蛮力法/邻接矩阵 广度优先 有向带权图 无向带权图
JPEG Steganalysis of Digital Image Steganography
软件测试工作3年了,谈谈我是如何从刚入门进阶到自动化测试的?
35. 反转链表
Kyushu cloud as cloud computing standardization excellent member unit