Skip to content
hikari
RenderingEditorAIToolchainDocumentation
GitHub
hikari

© 2026 Flying Rat Studio.
All rights reserved.

Explore the engineDocumentationContributorsLicenseBack to top
Documentation / Tutorials
Browse docs
Overview
Tutorials16
OverviewFirst game projectFirst entityAuthored user_data and the inspectorFirst mesh and materialFirst physics body and triggerFirst character controllerFirst session servicesFirst UIFirst input actionFirst messagesPlay, Edit, and scenesFirst runtime spawnFirst motionFirst skeletal animationAssets in Play (soft refs and hot reload)Dynamic editor recompile
Guides16
OverviewDevelopment guideGameplay APIChoosing component storageBuild and packagingProject filePluginsHikari Plugin APIData-driven content, JSON, and pathsScripting with KawaShader authoringTime of dayUser interfaceUI layoutUI widgetsMigration from Unity / UnrealActor and component lifecycle
Systems28
OverviewArchitectureApplication lifecycleFrontends and driversPlatforms and supportSession services and cross-scene stateScenes and gameplayActor communication (hi.actors)Game-facing refsSave / replication wire versionCoordinate space and camera conventionsRenderingRenderer architecture mapFrame governorGPU particlesVisual ZonesVolumetric mediaInputAudioPhysicsMotion KitTemporal KitAssets and ShinraPrefabsAsset residencyAsset formats (Shinra pipeline)UI and editorEditor asset hot reloadEditor Project Selector
Language reference2
OverviewAkari language referenceKawa language reference
Engine overview
Start exploring
  • No matching sections. Try fewer words or another topic.
NavigateEnter Openesc Close
Overview
Tutorials16
OverviewFirst game projectFirst entityAuthored user_data and the inspectorFirst mesh and materialFirst physics body and triggerFirst character controllerFirst session servicesFirst UIFirst input actionFirst messagesPlay, Edit, and scenesFirst runtime spawnFirst motionFirst skeletal animationAssets in Play (soft refs and hot reload)Dynamic editor recompile
Guides16
OverviewDevelopment guideGameplay APIChoosing component storageBuild and packagingProject filePluginsHikari Plugin APIData-driven content, JSON, and pathsScripting with KawaShader authoringTime of dayUser interfaceUI layoutUI widgetsMigration from Unity / UnrealActor and component lifecycle
Systems28
OverviewArchitectureApplication lifecycleFrontends and driversPlatforms and supportSession services and cross-scene stateScenes and gameplayActor communication (hi.actors)Game-facing refsSave / replication wire versionCoordinate space and camera conventionsRenderingRenderer architecture mapFrame governorGPU particlesVisual ZonesVolumetric mediaInputAudioPhysicsMotion KitTemporal KitAssets and ShinraPrefabsAsset residencyAsset formats (Shinra pipeline)UI and editorEditor asset hot reloadEditor Project Selector
Language reference2
OverviewAkari language referenceKawa language reference
Engine overview
Tutorials2 min read

Tutorial: first motion

On this page
On this pageTween on an entity fieldWave / helpersHUD motionVerifyNext Back to top

Motion Kit (hi.motion, hi.Tween, hi.Spring, …) animates values you own — entity fields, subsystem HUD state, editor chrome. Do not hang timelines on UiContext.

Deep reference: Motion Kit. Sample: disco_light_data.zig (disco_light archetype).

Tween on an entity field

zig
const hi = @import("hikari_game");

const FadeLight = struct {
    intensity: f32 = 2.0,
    fade: hi.Tween = .{},

    pub const metadata = .{
        .properties = .{
            .intensity = hi.UserDataPropertyOptions{ .label = "Intensity", .min = 0 },
            .fade = hi.UserDataPropertyOptions{ .transient = true },
        },
    };

    pub fn start(self: *@This(), id: hi.ActorRef) void {
        self.fade = hi.Tween.init(0.0, self.intensity, 1.5, .ease_out_cubic);
        hi.render().setLight(id, .{ .intensity = 0.0 });
    }

    pub fn update(self: *@This(), id: hi.ActorRef, ctx: *const hi.TickContext) void {
        hi.render().setLight(id, .{ .intensity = self.fade.update(ctx.dt) });
    }
};

Wave / helpers

zig
const bob = hi.motion.wave(ctx.total_time * bob_speed + phase) * amplitude;
hi.world().setPosition(id, .{ x, base_y + bob, z });

Respect reduce_motion when driving UI opacity/shift: use hi.motion.resolve (see Motion Kit + accessibility prefs).

HUD motion

Store Tween / Spring on GameSubsystem (or a scene HUD entity), sample into widget styles each onTick / update. Retained editor chrome uses opacity / shift on WidgetStyle plus overlay_motion.zig — same value layer, different host.

Verify

  1. Play a disco_light in physics_playground.json — lights fade in and orbit.
  2. Change intensity in the inspector — sample onChanged restarts a tween.
  3. Enable Reduce motion in editor settings — UI transitions snap; gameplay waves still run unless you gate them yourself.

Next

  • First user_data
  • First UI
PreviousTutorial: first runtime spawnNext Tutorial: first skeletal animation

Documentation follows the current engine checkout.

Snapshot cc148c75Source docs/tutorials/first-motion.md
On this pageTween on an entity fieldWave / helpersHUD motionVerifyNext Back to top