abstract_lerp 1.0.0

  • Readme
  • Changelog
  • Installing
  • 59

abstract_lerp #

extra_pedantic on pub.dev Travis CI Codecov License Pub.dev Github Stars Twitter Follow GitHub Follow

Lerping for abstract_dart Fields.

/// A double lerp.
final Lerp<double> _double = DoubleLerp(10.0, 20.0);

/// A num lerp.
final Lerp<num> _num = NumLerp(10.0, 20.0);

/// A decimal lerp.
final Lerp<Decimal> _decimal =
    DecimalLerp(Decimal.fromInt(10), Decimal.fromInt(20));

/// A custom lerp.
///
/// Multiplication, division, addition and subtraction are needed for a lerp.
/// A Field provides all of that.
final FieldLerp<double> _customLerp = FieldLerp(
  /// from
  10.0,

  /// to
  20.0,
  Field_.create(
    /// addition
    Group_.create(() => 0.0, (a, b) => a + b, (a, b) => a - b),

    /// multiplication
    Group_.create(() => 1.0, (a, b) => a * b, (a, b) => a / b),
  ),
);

print(_double.lerp(0.7)); // 17.0;
print(_double.reLerp(17.0)); // 0.7;
print(_num.lerp(0.7)); // 17.0;
print(_num.reLerp(17.0)); // 0.7;
print(_decimal.lerp(Decimal.parse("0.7"))); // 17.0;
print(_decimal.reLerp(Decimal.parse("17"))); // 0.7;
print(_customLerp.lerp(0.7)); // 17.0;
print(_customLerp.reLerp(17.0)); // 0.7;

final fromZero = _customLerp.copyWith(from: 0.0);

print(fromZero.lerp(0.7)); // 14.0;
print(_customLerp.reLerp(14.0)); // 0.7;

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  abstract_lerp: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:abstract_lerp/abstract_lerp.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
19
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and abstract_lerp.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.4 <3.0.0
abstract_dart ^1.0.0 1.0.2
decimal ^0.3.5 0.3.5
Transitive dependencies
rational 0.3.8
Dev dependencies
extra_pedantic ^1.1.1+3
test ^1.5.0
test_coverage ^0.2.0