当前位置:网站首页>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!
边栏推荐
- Multiplication, DFS order
- 勾股数元组 od js
- 1.非类型模板参数 2.模板的特化 3.继承讲解
- 无线模块的参数介绍和选型要点
- Parameter introduction and selection points of wireless module
- Centos 7.9安装PostgreSQL14.4步骤
- C language _ structure pointer array function voting system
- 【genius_platform软件平台开发】第七十四讲:window环境下的静态库和动态库的一些使用方法(VC环境)
- Analyze the capabilities and scenarios of the cloud native message flow system Apache Pulsar
- 【微信小程序】一文带你了解数据绑定、事件绑定以及事件传参、数据同步
猜你喜欢

tensorflow与GPU版本对应安装问题

《MySQL数据库进阶实战》读后感(SQL 小虚竹)

射频器件的基本参数1

The sword refers to offer17---print the n digits from 1 to the largest

What have I experienced when I won the offer of BAT and TMD technical experts?

"Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis

prometheus 监控概述

观察者(observer)模式(一)

Google官方控件ShapeableImageView使用

MySQL的存储过程
随机推荐
Crawler text data cleaning
What is the ideal college life?
《实战》基于电商领域的词性提取及其决策树模型建模
数字图像隐写术之卡方分布
GCC Rust获批将被纳入主线代码库,或将于GCC 13中与大家见面
仿牛客网项目总结
基于Keras_bert模型的Bert使用与字词预测
Bert usage and word prediction based on Keras_bert model
最高月薪20K?平均薪资近万...在华为子公司工作是什么体验?
倍增、DFS序
Centos 7.9安装PostgreSQL14.4步骤
C language _ structure pointer array function voting system
简易表白小页面
使用PageHelper实现分页查询(详细)
What have I experienced when I won the offer of BAT and TMD technical experts?
Multiplication, DFS order
Distributed. Distributed lock
VSCode插件:嵌套注释
Likou Daily Question - Day 46 - 704. Binary Search
rpm安装postgresql12