Azoft / CarouselLayoutManager

Android Carousel LayoutManager for RecyclerView
Apache License 2.0
2.56k stars 367 forks source link

On scroll center Item looks jumpy #94

Open sagarhudge opened 5 years ago

sagarhudge commented 5 years ago

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);`
asadmukhtar28 commented 5 years ago

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

hannnhb commented 1 year ago

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