纯css模拟手机充电动画效果

代码语言:html

所属分类:动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
   
<meta charset="UTF-8">


   
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
   
<style>

        * {
            box-sizing: border-box;
        }
        body {
            overflow: hidden;
            display: flex;
            height: 100vh;
            margin: 0;
            padding: 0;
            background-color: black;
        }

        .reset {
            opacity: 0;
            position: absolute;
            bottom: 30px;
            right: 30px;
            animation: reset 13s forwards;
            background: black;
            border: 0 none;
        }
        .reset input {
            background: black;
            color: white;
            border: 0 none;
        }

        .phone {
            --width: 320px;
            --height: 490px;
            margin: auto auto 0 auto;
            width: var(--width);
            height: var(--height);
            position: relative;
        }

        .text {
            font-family: sans-serif;
            color: darkgray;
            position: absolute;
            z-index: 2;
            left: 0;
            right: 0;
            text-align: center;
            top: 180px;
            font-size: 17px;
        }

        .status {
            width: 190px;
            justify-content: center;
            display: flex;
            align-items: center;
            color: white;
            position: absolute;
            top: 125px;
            left: 0;
            right: 0;
            margin: auto;
            z-index: 3;
        }

        .progress {
            font-size: 3em;
            font-family: sans-serif;
            margin-left: 8px;
            display: flex;
            color: transparent;
        }
        .progress > small {
            font-size: 18px;
            margin-left: 5px;
            color: white;
        }
        .progress::before {
            content: '99';
            color: white;
            animation: count 12s forwards;
        }

        .charging {
            background-color: white;
            width: 11px;
            height: 11px;
            transform: skew(0deg, -45deg) rotate(47deg) scale(0.7);
        }
        .charging::before {
            content: '';
            position: absolute;
            border-width: 7px 5px 15px 7px;
            border-style: solid;
            top: -18px;
            border-color: transparent transparent white transparent;
            transform: rotate(5deg) skew(-10deg, -5deg);
            left: -8px;
        }
        .charging::after {
            content: '';
            position: absolute;
            border-width: 7px 5px 15px 7px;
            border-style: solid;
            bottom: -18px;
            border-color: transparent transparent white transparent;
            transform: rotate(-175deg) skew(-10deg, -5deg);
            left: 6px;
        }

        .contrast {
            width: 100%;
            height: 100%;
            backgroun.........完整代码请登录后点击上方下载按钮下载查看

网友评论0