harusaki 0.0.3

  • Readme
  • Changelog
  • Installing
  • 57

春先 Harusaki #

A super simple SpringSimulation API for Flutter, providing conventional defaults.

Usage #

import 'package:harusaki/harusaki.dart';

final controller = AnimationController(/* ... */)

/// 1) just animate with the simulation...

    from: 0.0,
    to: 1.0,

/// 2) or grab a velocity value to animate with:

onDragEnd: (details) {

  // assumes we're dragging something the size of the screen in a vertical direction
  final velocity = details.primaryVelocity / MediaQuery.of(context).size.height;

      from: controller.value,
      to: 1.0,
      velocity: velocity,


We use the same defaults as react-spring, so you have the following spring simulations to choose from

  • SpringDescription Harusaki.normal([double velocity = 0]) ("default" in react-spring)
  • SpringDescription Harusaki.gentle([double velocity = 0])
  • SpringDescription Harusaki.wobbly([double velocity = 0])
  • SpringDescription Harusaki.stiff([double velocity = 0])
  • SpringDescription Harusaki.slow([double velocity = 0])
  • SpringDescription Harusaki.molasses([double velocity = 0])

and you can create a conventional simulation with

  • SpringSimulation Harusaki.spring(double stiffness, double damping, [double velocity])

and get the default tolerance with

  • Tolerance Harusaki.tolerance

Inspo #

harusaki is inspired by lukepighetti/sprung and react-spring/react-spring.

The haru packagename was already taken, so we'll go with "the beginning of spring" as a motif ¯\_(ツ)_/¯

Notes #

As far as I can tell, stiffness and tension are the same concept and damping and friction are the same concept.

I've implemented a HarusakiAnimationController that replaces all of the normal linear animations with spring-based simulations. Since it conforms to AnimationController, it can be passed to any widgets that expect one. Then when those widgets call .forward or .reverse or .fling, it'll use the spring description you've provided to animate the value, rather than the default linear interpolation.

I haven't decided if this is useful or not yet.

0.0.3 #

  • added HarusakiAnimationController
  • added Harusaki.controller() factory method for controllers

0.0.2 #

  • added velocity arguments to all methods

0.0.1 #

  • Initial version.

Use this package as a library

1. Depend on it

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

  harusaki: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support 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:harusaki/harusaki.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/src/harusaki.dart.

Run flutter format to format lib/src/harusaki.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

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

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0
test ^1.6.0