小球点击后抛物线移动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
    <style>
        * {
            padding: 0;
            margin: 0;
        }
 
        html,
        body {
            width: 100%;
            height: 100%;
        }
 
        #ball {
            display: none;
            width: 10px;
            height: 10px;
            background: red;
            border-radius: 50%;
            position: absolute;
            bottom: 100px;
            right: 100px;
        }
    </style>
</head>
 
<body>
    <div id="ball"></div>
 
    <script>
        var ball = document.getElementById('ball');
        document.onclick = function (e) {
            ball.style.top = e.pageY + 'px';
            ball.style.left = e.pageX + 'px';
            ball.style.transition = 'left 1s, top 1s';
            ball.style.display = 'block';
            setTimeout(function () {
                ball.style.top =  '200px';
                ball.style.left = '300px';
                ball.style.transition = 'left 2s linear, top 2s cubic-bezier(0.07, 0.91, 0.53, 1.04)';
            }, 20)
        }
    </script>
</body>
 
</html>

  

posted @   每天都是鑫的媛  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示