Skip to content

Implement useAngle, angleCenter, and angle props #10

@airandfingers

Description

@airandfingers

This package takes the props useAngle, angleCenter, and angle, but it doesn't use them, instead calculating the angle in getAngle based on start, end, width, and height.

From the react-native-linear-gradient docs:

useAngle / angle / angleCenter

You may want to achieve an angled gradient effect, similar to those in image editors like Photoshop.
One issue is that you have to calculate the angle based on the view's size, which only happens asynchronously and will cause unwanted flickr.

In order to do that correctly you can set { useAngle: true, angle: 45, angleCenter: { x: 0.5, y: 0.5} }, to achieve a gradient with a 45 degrees angle, with its center positioned in the view's exact center.

useAngle is used to turn on/off angle based calculation (as opposed to start/end).
angle is the angle in degrees.
angleCenter is the center point of the angle (will control the weight and stretch of the gradient like it does in photoshop.

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