Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

弹跳效果 #54

Open
l-hammer opened this issue Apr 10, 2018 · 1 comment
Open

弹跳效果 #54

l-hammer opened this issue Apr 10, 2018 · 1 comment

Comments

@l-hammer
Copy link
Owner

https://l-hammer.github.io/You-need-to-know-css/#/bounce

You-need-to-know-css,CSS tricks web developers need to know

@l-hammer l-hammer changed the title 弹跳效果 - CSS Tricks 弹跳效果 Apr 19, 2018
@lcl-101
Copy link

lcl-101 commented Nov 25, 2020

这个小球的动画有点太生硬了,给你推荐一个方法,自己从安卓包里提取出来的

function bounce(t){
            var ts=t * t * 8.0;
            return ts;
        }
        function getInterpolation(t){
            var t = t*1.1226;
            if(t<0.3535){
                return bounce(t);
            }else if(t < 0.7408){
                return bounce(t - 0.54719) + 0.7;
            }else if(t < 0.9644){
                return bounce(t - 0.8526) + 0.9;
            }else {
                return bounce(t - 1.0435) + 0.95;
            }
        }
        var tt=0;
        setInterval(function(){
            tt++;
            if(tt>=1000){
                return;
            }
            var s=-50*getInterpolation(tt / 1000)+50;
            $('.qing-transform').show().css({transform: 'rotate('+-s+'deg)','-webkit-transform': 'rotate('+-s+'deg)','-moz-transform': 'rotate('+-s+'deg)','-o-transform': 'rotate('+-s+'deg)'})
        },1)

演示地址

demo
image

自由落体文档地址

自由落体

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants