remaths 0.0.2 copy "remaths: ^0.0.2" to clipboard
remaths: ^0.0.2 copied to clipboard

outdated

A new Flutter package that provide handy functions to help in gesture animations and other calculations.

reMath #

enter image description here

Hi, this is reMath, a flutter package that provide handy functions to help in gesture animations and other calculations. this is inspired by the react-native reanimated package. Thanks to software mansion for react-native reanimated

Operators and helpers #

    abs(node); //Evaluates the given node and returns an absolute value of the node's value.
    add(num1, num2) // Takes two or more animated nodes or values, and when evaluated, returns their sum.
    ceil(num); //Returns a node that rounds a number up to its nearest integer. If the passed argument is an integer, the value will not be rounded.
    divide(num, num2); //Takes two or more animated nodes or values, and when evaluated, returns the result of dividing their values in the exact order.
    exp(node); // Returns an exponent of the value of the given node.
    floor(node); // Returns a node that rounds a number down to its nearest integer. If the passed argument is an integer, the value will not be rounded.
    max(num1, num2); // Takes two nodes as an input and returns a maximum of all the node's values.
    multiply(num1, num2) // Takes two or more animated nodes or values, and when evaluated, returns the result of multiplying their values in the exact order.

conditional operation #

    cond(condition, ifBlock,  [elseBlock]);

If condition evaluates to "truthy" value the node evaluates ifBlock node and returns its value, otherwise it evaluates elseBlock and returns its value. elseBlock is optional.

interpolations #

    interpolate(value,  {
    // Input range for the interpolation. Should be monotonically increasing.
    inputRange:  [value...],
    // Output range for the interpolation, should be the same length as the input range.
    outputRange:  [value...],
    // Sets the left and right extrapolate modes.
    extrapolate?:  Extrapolate.EXTEND  |  Extrapolate.CLAMP  |  Extrapolate.IDENTITY,
    // Set the left extrapolate mode, the behavior if the input is less than the first value in inputRange.
    extrapolateLeft?:  Extrapolate.EXTEND  |  Extrapolate.CLAMP  |  Extrapolate.IDENTITY,
    // Set the right extrapolate mode, the behavior if the input is greater than the last value in inputRange.
    extrapolateRight?:  Extrapolate.EXTEND  |  Extrapolate.CLAMP  |  Extrapolate.IDENTITY,
    })
    Extrapolate.EXTEND;  // Will extend the range linearly.
    Extrapolate.CLAMP;  // Will clamp the input value to the range.
    Extrapolate.IDENTITY;  // Will return the input value if the input value is out of range.

Usage

    var value = interpolate(0.5,{ inputRange: [0,  1], outputRange: [10,  0] }), // returns 5

interlation of colors #

    interpolateColors(value,  {
    // Input range for the interpolation. Should be monotonically increasing.
    inputRange:  [value,  ...],
    // Output colors range for the interpolation.
    // Should be the same length as the input range.
    //
    // Each color should be a of type Color
    // or a number like Colors.red or Color(0xff112233).
    outputColorRange:  [Color,  ...],
    })

example

   const color =  interpolateColors(0.3,  {
    inputRange:  [0,  1],
    outputColorRange:  [Colors.red,  Colors.blue],
   });

License #

Remaths library is licensed under The MIT License.

Credits #

This project has been build and is maintained thanks to the support from the Ormanel Community

5
likes
0
pub points
44%
popularity

Publisher

unverified uploader

A new Flutter package that provide handy functions to help in gesture animations and other calculations.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on remaths