Skip to content

On scroll center Item looks jumpy #94

@sagarhudge

Description

@sagarhudge

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);`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions