惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
T
Threatpost
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - Franky
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
S
Security Affairs
P
Proofpoint News Feed
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
S
Security @ Cisco Blogs
H
Hacker News: Front Page
Security Archives - TechRepublic
Security Archives - TechRepublic
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
Know Your Adversary
Know Your Adversary
Y
Y Combinator Blog
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
月光博客
月光博客
量子位
博客园_首页
The Last Watchdog
The Last Watchdog
D
DataBreaches.Net
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
The Register - Security
The Register - Security
Schneier on Security
Schneier on Security
H
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
L
Lohrmann on Cybersecurity
S
Secure Thoughts
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
Microsoft Security Blog
Microsoft Security Blog

博客园 - howhy

html 元素包含关系 this 指向 空对象 Object.keys for ...in Reflect.ownKeys ...区别 逻辑运算符和空值运算符 运算符优先级 js 类型显式转换 js 高级函数 js 方法重载 fetch timeout js 任务顺序执行 暂停 js 并发任务 判断两个对象是否相同 js 动态拦截属性 js groupby js 防抖和节流 实现 instanceof 操作符 js 单例模式 js 数组去重和扁平方法 js 继承方法 js new的过程实现 js deepCopy js '=='的隐性类型转换规则
js 通用动画
howhy · 2025-12-31 · via 博客园 - howhy
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
            box-sizing: border-box;
        }
        .box{
            margin: 200px;
        }
        .circle_outter{
            width: 200px;
            height: 200px;
            border: 1px solid;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: antiquewhite;
        }
        .circle_inner{
            width: 100px;
            height: 100px;
            border: 1px solid;
            border-radius: 50%;
            background-color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
        }
        .circle_inner>div{
            position: absolute;
            display: flex;
            justify-content: center;
        }
        .circle_inner>div:nth-child(2){
            color:red;
            transform: rotate(0deg) translate(0px, -75px) rotate(-0deg);
        }
        .circle_inner>div:nth-child(3){
            color:red;
            transform: rotate(0deg) translate(75px) rotate(-0deg);
        }
        .circle_inner>div:nth-child(4){
            color:red;
            transform: rotate(0deg) translate(0,75px) rotate(-0deg);
        } 
        .circle_inner>div:nth-child(5){
            color:red;
            transform: rotate(0deg) translate(-75px) rotate(-0deg);
        }
    </style>
</head>
<body>
    <div class="box">
    <div class="circle_outter">
        <div class="circle_inner">
            <div class="home">#</div>
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
        </div>
    </div>
    <button class="btn">打折</button>
    <label for="">价格:6699.00</label>
    </div>
    <script src="./b.js"></script>
    <script>
        function animation(duration,from,to,handler){
            let value=from;
            const speed=(to-from)/duration;
            const startTime=Date.now();
            function _run(){
                const t=Date.now()-startTime;
                if(t>=duration){
                value=to;
                handler(value);
                return;
                }
                value=from+t*speed;
                handler(value);
                requestAnimationFrame(_run);
            }
            _run();
        }
        const label=document.querySelector('label');
        const btn=document.querySelector('.btn');
        btn.onclick=function(){
            animation(2000,6699,30,(value)=>{
                label.textContent=`价格:${value}`
            });
        }
    </script>
</body>
</html>

posted @ 2025-12-31 10:05  howhy  阅读(52)  评论()    收藏  举报