nima 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 85

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.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.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:nima/nima_actor.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue
      ),
      home: new MyHomePage(title: 'Flutter + Nima'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _animationName = "idle";

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
		backgroundColor: Colors.grey,
		appBar: new AppBar(
			title: new Text(widget.title)
		),
		body: new Stack(
			children: <Widget>[
			  	new Positioned.fill(
					child: NimaActor("assets/Hop", alignment:Alignment.center, fit:BoxFit.contain, animation:_animationName, mixSeconds:0.5, completed:(String animationName)
					{
						setState(()
						{
							// Return to idle.
							_animationName = "idle";
						});
					})
				),
				new Positioned.fill(
					child: new Row(
						crossAxisAlignment: CrossAxisAlignment.end,
						mainAxisAlignment: MainAxisAlignment.center,
						children: <Widget>[
						  new Container(
								margin: const EdgeInsets.all(5.0), 
								child: new FlatButton(
									child: new Text("Jump"), 
									textColor: Colors.white, 
									color: Colors.blue, 
									onPressed:() 
									{
										setState(() 
										{
											_animationName = "jump";
										});
									}
								)
							),
						  new Container(
								margin: const EdgeInsets.all(5.0), 
								child: new FlatButton(
									child: new Text("Attack"), 
									textColor: Colors.white, 
									color: Colors.blue, 
									onPressed:() 
									{
										setState(() 
										{
											_animationName = "attack";
										});
									}
								)
							),
				  		],
					)
				)
		  ]
      )
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  nima: "^1.0.0"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.0 May 6, 2018 Go to the documentation of nima 1.0.0 Download nima 1.0.0 archive

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
72 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
85
Learn more about scoring.

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 warnings 39 hints.

    Strong-mode analysis of lib/nima/animation/keyframe.dart gave the following warning:

    line: 221 col: 3
    Missing case clause for 'Progression'.

    Strong-mode analysis of lib/nima/animation/value_time_curve_interpolator.dart gave the following warning:

    line: 73 col: 3
    Missing case clause for 'Linear'.

    Similar analysis of the following files failed:

    • lib/nima.dart (hint)
    • lib/nima/actor.dart (hint)
    • lib/nima/actor_bone.dart (hint)
    • lib/nima/actor_bone_base.dart (hint)
    • lib/nima/actor_component.dart (hint)
    • lib/nima/actor_constraint.dart (hint)
    • lib/nima/actor_event.dart (hint)
    • lib/nima/actor_ik_constraint.dart (hint)
    • lib/nima/actor_image.dart (hint)
    • lib/nima/actor_jelly_bone.dart (hint)
    • lib/nima/actor_loader.dart (hint)
    • lib/nima/actor_node.dart (hint)
    • lib/nima/actor_node_solo.dart (hint)
    • lib/nima/actor_root_bone.dart (hint)
    • lib/nima/actor_rotation_constraint.dart (hint)
    • lib/nima/actor_targeted_constraint.dart (hint)
    • lib/nima/animation/actor_animation.dart (hint)
    • lib/nima/animation/property_types.dart (hint)
    • lib/nima/binary_reader.dart (hint)
    • lib/nima/block_reader.dart (hint)
    • lib/nima/dependency_sorter.dart (hint)
    • lib/nima/jelly_component.dart (hint)
    • lib/nima/math/aabb.dart (hint)
    • lib/nima/math/mat2d.dart (hint)
    • lib/nima/math/transform_components.dart (hint)
    • lib/nima/math/vec2d.dart (hint)
    • lib/nima/transform_space.dart (hint)
    • lib/nima_actor.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

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.6 1.14.10
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7
Dev dependencies
test ^0.12.0