Skip to content

Max / Min scale for pinch #74

Closed
Closed

Description

@jhalborg

A prop for max/min scale relative to initial scale would be awesome!

Activity

  1. kmagiera commented on Dec 13, 2017

    @kmagiera
    Member

    Would you be able to provide more details on that? Do you want the scaling to stop at a certain scale level or have a min distance between fingers at which the pinch recognizer would activate?

    If the former is your choice you can achieve that by using Animated.interpolate:

    valueBoundToHandler = new Animated.Value(1);
    valueUsedInStyles = valueBoundToHandler.interpolate({
      inputRange: [0.5, 1.5],
      outputRange: [0.5, 1.5],
      extrapolate: 'clamp'
    });
    

    Don't try to run this code as I haven't tested it, just made it to mark my idea. The value that you should use in transform (valueUsedInStyles) is going to be clamped at 0.5 and 1.5

  2. jhalborg commented on Dec 14, 2017

    @jhalborg
    Author

    The former, and of course - had forgotten about interpolation. I'm sorry, I'm still a bit new to the Animated API.

    Thanks 😁

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions