nima 1.0.5

Nima-Flutter #

Flutter runtime written in Dart with SKIA based rendering.

Installation #

Add nima as a dependency in your pubspec.yaml file.

Exporting for Flutter #

Export from Nima with the Export to Engine menu. In the Engine drop down, choose Generic.

Adding Assets #

Once you've exported your character file. Add the .nima file and and the .png atlas files to your project's Flutter assets.

Make sure the .png files are at the same level as the.nima file. If you renamed your .nima file, make sure to rename your assets accordingly.

In the future we may opt to package the images into the .nima file as we do for WebGL. Let us know if you're in favor of this!

Example #

Take a look at the provided example application for how to use the NimaActor widget with an exported Nima character.

Usage #

The easiest way to get started is by using the provided NimaActor widget. This is a stateless Flutter widget that allows for one Nima character with one active animation playing. You can change the currently playing animation by changing the animation property's name. You can also specify the mixSeconds to determine how long it takes for the animation to interpolate from the previous one. A value of 0 means that it will just pop to the new animation. A value of 0.5 will mean it takes half of a second to fully mix the new animation on top of the old one.

import 'package:nima/nima_actor.dart';
class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new NimaActor("assets/Hop", alignment:Alignment.center, fit:BoxFit.contain, animation:"idle");
  }
}

Advanced Usage #

For more advanced usage such as creating views with multiple Nima characters, multiple active animations, and controllers, please refer to the internals of nima_actor.dart to get acquainted with the API. We'll be posting more detailed tutorials and documentation regarding the inner workings of the API soon.

Contributing #

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License #

See the LICENSE file for license rights and limitations (MIT).

[1.0.5] - 2019-07-16 08:50:43

  • Prevent advancing a null actor, which can occur due to a race condition when loading the Nima file.

[1.0.4] - 2019-07-11 10:00:50

  • Fix breaking index buffer format change (from Int32List to Uint16List).
  • Lots of static analysis fixes.

[1.0.3] - 2019-04-09 09:50:41

  • Making sure the Nima Actor widget is disposed of properly when the leaf render widet is unmounted or the render box is detached.

[1.0.0] - 5/5/2018

  • Initial release with an example NimaActor widget that implements a LeafRenderObjectWidget that can render a Nima actor. Alignment is done based on the setup axis aligned bounding box.

Use this package as a library

1. Depend on it

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


dependencies:
  nima: ^1.0.5

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:nima/nima.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
85
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.71 points)

900 out of 909 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/nima/animation/value_time_curve_interpolator.dart. (-1.99 points)

Analysis of lib/nima/animation/value_time_curve_interpolator.dart reported 4 hints:

line 98 col 10: The value of the field '_y0' isn't used.

line 101 col 10: The value of the field '_y1' isn't used.

line 104 col 10: The value of the field '_y2' isn't used.

line 107 col 10: The value of the field '_y3' isn't used.

Fix lib/nima/jelly_component.dart. (-1 points)

Analysis of lib/nima/jelly_component.dart reported 2 hints:

line 17 col 17: Name non-constant identifiers using lowerCamelCase.

line 18 col 17: Name non-constant identifiers using lowerCamelCase.

Fix lib/nima/actor_ik_constraint.dart. (-0.50 points)

Analysis of lib/nima/actor_ik_constraint.dart reported 1 hint:

line 279 col 5: Avoid empty statements.

Fix additional 4 files with analysis or formatting issues. (-1 points)

Additional issues in the following files:

  • lib/nima/actor_loader.dart (1 hint)
  • lib/nima/animation/actor_animation.dart (1 hint)
  • lib/nima.dart (Run flutter format to format lib/nima.dart.)
  • lib/nima/actor.dart (Run flutter format to format lib/nima/actor.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.

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

Common filename patterns include main.dart, example.dart, and nima.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.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test