当前位置:网站首页>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
- pc端判断当前使用浏览器类型
- case语句的综合结果,你究竟会了吗?【Verilog高级教程】
- 成为比开发硬气的测试人,我都经历了什么?
- 软件测试缺陷报告---定义,组成,缺陷的生命周期,缺陷跟踪产后处理流程,缺陷跟踪处理流程,缺陷跟踪的目的,缺陷管理工具
- 35. Reverse linked list
- C language _ structure pointer array function voting system
- keep-alive cache component
- Google官方控件ShapeableImageView使用
- uniapp使用第三方字体
猜你喜欢

tkinter模块高级操作(二)—— 界面切换效果、立体阴影字效果及gif动图的实现

MySQL的存储过程

The difference between 4G communication module CAT1 and CAT4

GCC Rust获批将被纳入主线代码库,或将于GCC 13中与大家见面

《云原生的本手、妙手和俗手》——2022全国新高考I卷作文

想要写出好的测试用例,先要学会测试设计

Word/Excel 固定表格大小,填写内容时,表格不随单元格内容变化
![[WeChat applet] This article takes you to understand data binding, event binding, event parameter transfer, and data synchronization](/img/f8/8437783794c2007a74c0a153d85102.png)
[WeChat applet] This article takes you to understand data binding, event binding, event parameter transfer, and data synchronization

Parameter introduction and selection points of wireless module

Mysql:Invalid default value for TIMESTAMP
随机推荐
I have been working in software testing for 3 years, how did I go from just getting started to automated testing?
黄东旭:TiDB的优势是什么?
kotlin中函数作为参数和函数作为返回值实例练习
Distributed. Idempotency
蓝牙mesh系统开发二 mesh节点开发
Ticmp - 更快的让应用从 MySQL 迁移到 TiDB
uniapp使用第三方字体
GCC Rust is approved to be included in the mainline code base, or will meet you in GCC 13
剑指offer17---打印从1到最大的n位数
VSCode插件:嵌套注释
MySQL (6)
Installation problem corresponding to tensorflow and GPU version
Interprocess communication study notes
太阳能板最大面积 od js
rpm安装postgresql12
Overview of prometheus monitoring
MySQL的分页你还在使劲的limit?
Multiplication, DFS order
tkinter模块高级操作(二)—— 界面切换效果、立体阴影字效果及gif动图的实现
ROS Action通信