zoukankan      html  css  js  c++  java
  • tweenMax实体抛物线

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <script src="jquery.js"></script>  
        <script src="TweenMax.min.js"></script>  
        <style>
        .div{position: absolute; 200px;height: 200px;top: 0;left: 0;}  
        .div2{ 40px;height: 30px;background-color:pink;border-radius: 50%;} 
        </style>
    </head>
    <body>
         
    </body>
    </html>
    
    <script>
    //目标位置
    var tx=500,ty=50;
    
    function move(obj,x,y){
        var t = new TimelineMax();
    // tweenmax-bezier曲线     staggerTo可以元素一起运动
        t.staggerTo(obj,1,{  
        // bezier函数返回数组   只有 staggerTo 才可以使用 cycle
        cycle : {  
            bezier : function(){  
                var max=Math.max(tx,x);
                var min=Math.min(tx,x);
                var val=(max-min)*0.5+min;
                return [  
                    {top:y,left:x},  
                    {top:Math.min(y,ty)*0.5,left:val},  
                    {top:ty,left:tx},  
                ]  
            }  
            },
            onComplete:function(){
            $(obj).fadeOut(function(){
                $(this).remove();
            });
            }  
        }
    );
    }
    
    var i=0;
    $(document).on("click",function(e){
        var x=e.pageX,
            y=e.pageY;
            console.log(x,y);
            $('<div class="div div2 div2'+i+'"></div>').appendTo("body").css({top:y,left:x});
            move(".div2"+i,x,y);
            i++;
    });
    </script>
  • 相关阅读:
    2.1 maven配置多镜像地址
    6.4 SpringData JPA的使用
    4.3 thymeleaf模板引擎的使用
    java面试题整理
    eclipse配置运行时变量
    postman上传文件
    Python定义字符串、循环
    Charles抓包
    jmeter压测
    JMeter,postman
  • 原文地址:https://www.cnblogs.com/zhangzhicheng/p/7492531.html
Copyright © 2011-2022 走看看