GithubHelp home page GithubHelp logo

Comments (8)

lucklygaj avatar lucklygaj commented on May 23, 2024

你好,在这里设置的

    // y = x - (x/2)^2
    float extraOS = nextOffsetTop - totalDragDistance;
    float slingshotDist = totalDragDistance;
    float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2) / slingshotDist);
    float tensionPercent = (float) (tensionSlingshotPercent - Math.pow(tensionSlingshotPercent / 2, 2));

    if (offset > 0) { // 下拉的时候才添加阻力
        offset = (int) (offset * (1f - tensionPercent));
        nextOffsetTop = Math.max(0, currentOffsetTop + offset);
    }

希望能帮到你

from easyrefreshlayout.

sj8521123 avatar sj8521123 commented on May 23, 2024

能不能提供现有一个接口或者方法出来修改下拉的阻尼系数,因为我是直接用的gradle方式加载的库,不然只有把你的库手动导入进来修改。

from easyrefreshlayout.

lucklygaj avatar lucklygaj commented on May 23, 2024

可以的

from easyrefreshlayout.

lucklygaj avatar lucklygaj commented on May 23, 2024

已在1.1.4的版本中增加,感谢您的反馈

from easyrefreshlayout.

sj8521123 avatar sj8521123 commented on May 23, 2024

谢谢

from easyrefreshlayout.

sj8521123 avatar sj8521123 commented on May 23, 2024

打扰了,更新了1.1.4 发现有个setPUll_RESISTANCE(),但是设置任何double值都阻尼没变化,还有这个方法名能不能小写,public static void setPUll_RESISTANCE(double PUll_RESISTANCE) {
PUll_RESISTANCE = PUll_RESISTANCE;
}
是不是应该写成 this.PUll_RESISTANCE = PUll_RESISTANCE;

from easyrefreshlayout.

lucklygaj avatar lucklygaj commented on May 23, 2024

PUll_RESISTANCE 是属于static的,我改成对象的了,公式是y = x - (x/a)^2 a是PUll_RESISTANCE 这阻尼滑动效果我也是参考网上一位大神的,1.1.5已修改,希望对你有帮助

from easyrefreshlayout.

lucklygaj avatar lucklygaj commented on May 23, 2024

你看下,如果有需要的话,我暴露个返回最终y值的接口出来给你,里面的阻尼公示由你们来定义

from easyrefreshlayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.