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

On scroll center Item looks jumpy #94

Open
sagarhudge opened this issue Apr 12, 2019 · 2 comments
Open

On scroll center Item looks jumpy #94

sagarhudge opened this issue Apr 12, 2019 · 2 comments

Comments

@sagarhudge
Copy link

When I am trying to scroll list the view in center position it looks like jumping to center position
in ItemTransformation transformChild method
`final float scale = (float) (2 * (2 * -StrictMath.atan(Math.abs(itemPositionToCenterDiff) + 1.0) / Math.PI + 1));

    // because scaling will make view smaller in its center, then we should move this item to the top or bottom to make it visible
    final float translateY;
    final float translateX;
    if (CarouselLayoutManager.VERTICAL == orientation) {
        final float translateYGeneral = child.getMeasuredHeight() * (1 - scale) / 2f;
        translateY = Math.signum(itemPositionToCenterDiff) * translateYGeneral;
        translateX = 0;
    } else {

// final float translateXGeneral = child.getMeasuredWidth() * (1 - scale) / 2f;
final float translateXGeneral = child.getMeasuredWidth() * (0.9f - scale) / 1.7f;

        translateX = Math.signum(itemPositionToCenterDiff) * translateXGeneral;
        translateY = 0;
    }


    return new ItemTransformation(scale, scale, translateX, translateY);`
@sagarhudge sagarhudge changed the title On scroll center Item look jumpy On scroll center Item looks jumpy Apr 12, 2019
@asadmukhtar28
Copy link

where is the complete code for removing that jumpy jerk, kindly i need it. @sagarhudge

@hannnhb
Copy link

hannnhb commented Mar 3, 2023

Kindly, I need code for removing that jumpy jerk. Please help! Thanks!

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

No branches or pull requests

3 participants