Skip to content

Haki Avatar

A sprite-strip avatar that powers up into Conqueror’s Haki, with a flash, shockwave, and shake at full power.

shadcn registry · install below

Installation

pnpm dlx shadcn@latest add https://www.sudhanshuxsingh.in/r/haki-avatar.json

Needs a project with shadcn/ui set up. The source lands in your codebase, ready to edit.

Usage

"use client";

import { useState } from "react";
import { HakiAvatar } from "@/components/ui/haki-avatar";

export function Avatar() {
  const [playing, setPlaying] = useState(false);
  const [run, setRun] = useState(0);

  return (
    <button
      type="button"
      aria-label="Play power-up animation"
      onClick={() => {
        setRun((value) => value + 1);
        setPlaying(true);
      }}
      className="w-52 touch-manipulation select-none"
    >
      <HakiAvatar
        key={run}
        src="/sprites/me-haki.webp"
        frames={8}
        aspectRatio={250 / 340}
        playing={playing}
        loop={false}
        onEnd={() => setPlaying(false)}
        label="My avatar"
      />
    </button>
  );
}