humation 0.1.0 copy "humation: ^0.1.0" to clipboard
humation: ^0.1.0 copied to clipboard

Deterministic hand-drawn kawaii avatar engine for Dart. One seed in, one avatar out. Pure Dart, no Flutter, no network, no AI.

humation #

Deterministic hand-drawn kawaii avatar engine for Dart. Pure Dart, no Flutter, no network, no AI. One seed in, one avatar out.

This is the engine. It resolves a seed to a fixed set of parts and produces an SVG string or structured render data. For a Flutter widget, use humation_flutter. For the ready made artwork, use humation_assets_humation_1.

Part selection is byte-identical to the reference Humation engine (FNV-1a over UTF-16 code units), so the same seed yields the same avatar on web, native, and Flutter.

Community port by Hark Singh, not affiliated with the Humation Labs team. Engine design is from humation-labs (MIT).

Install #

dependencies:
  humation: ^0.1.0
  humation_assets_humation_1: ^0.1.0   # the default artwork

Usage #

import 'package:humation/humation.dart';
import 'package:humation_assets_humation_1/humation_assets_humation_1.dart';

final manifest = humation1Manifest;

// Seed to a self-contained SVG string.
final svg = createAvatar(
  manifest,
  const CreateAvatarOptions(seed: 'felix'),
).toSvg();

// Pick parts and colours by name.
final custom = createAvatar(
  manifest,
  const CreateAvatarOptions(
    selections: {'head': 'braids', 'body': 'hoodie'},
    colors: {'hair': '#123456'},
  ),
).toSvg();

The SVG uses var(--hm-*) colour variables with the values set on the root element, so it recolours through CSS in any viewer that supports custom properties. Serve it, write it to a file, or hand it to a browser.

API #

  • createAvatar(manifest, options) returns a HumationAvatar with toSvg(), toDataUri(), toJson(), and toRenderData().
  • resolveAvatarState(manifest, options) returns the resolved AvatarState (concrete part per slot, concrete hex per colour slot).
  • resolvePartId(input, manifest, slotId: ...) resolves ids, aliases, and slot-scoped names.
  • getPartsForSlot / getPartsForUiGroup list parts for pickers.
  • validateManifest(manifest) lints a custom pack against the supported SVG subset. An empty result means it is renderable.
  • fnv1a and normalizeHex are the shared primitives.

toRenderData() returns an AvatarRenderData (view box, background, colours, and ordered fragments). This is what native renderers such as humation_flutter consume.

License #

MIT. Engine design is from humation-labs/humation (MIT).

0
likes
160
points
34
downloads

Documentation

API reference

Publisher

verified publisher0xharkirat.com

Weekly Downloads

Deterministic hand-drawn kawaii avatar engine for Dart. One seed in, one avatar out. Pure Dart, no Flutter, no network, no AI.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#avatar #svg #identicon #deterministic

License

MIT (license)

More

Packages that depend on humation