{"id":51063598,"url":"https://github.com/deblasis/ziosprite","last_synced_at":"2026-06-23T04:30:29.949Z","repository":{"id":355013904,"uuid":"1226237238","full_name":"deblasis/ziosprite","owner":"deblasis","description":"Sprite sheet animator for Zig 2D games. Loop modes, ping-pong. 40 tests.","archived":false,"fork":false,"pushed_at":"2026-05-01T12:28:03.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T13:24:54.916Z","etag":null,"topics":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deblasis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"deblasis","ko_fi":"deblasis","custom":["https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"]}},"created_at":"2026-05-01T06:14:09.000Z","updated_at":"2026-05-01T12:28:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/deblasis/ziosprite","commit_stats":null,"previous_names":["deblasis/ziosprite"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deblasis/ziosprite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziosprite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziosprite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziosprite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziosprite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deblasis","download_url":"https://codeload.github.com/deblasis/ziosprite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziosprite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34675970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"created_at":"2026-06-23T04:30:29.159Z","updated_at":"2026-06-23T04:30:29.941Z","avatar_url":"https://github.com/deblasis.png","language":"Zig","funding_links":["https://github.com/sponsors/deblasis","https://ko-fi.com/deblasis","https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"],"categories":[],"sub_categories":[],"readme":"# ziosprite\n\n\u003e Sprite sheet animator for Zig 2D games. Frame-based animation, loop modes, ping-pong.\n\nPart of the [zio-zig](https://github.com/deblasis/zio-zig) ecosystem.\n\n## Quick start\n\n```zig\nconst zsprite = @import(\"ziosprite\");\n\n// Define a walk animation from a sprite sheet\nconst walk = zsprite.Animation{\n    .frames = \u0026.{\n        .{ .x = 0,   .y = 0, .w = 32, .h = 32, .duration_ns = 80_000_000 },\n        .{ .x = 32,  .y = 0, .w = 32, .h = 32, .duration_ns = 80_000_000 },\n        .{ .x = 64,  .y = 0, .w = 32, .h = 32, .duration_ns = 80_000_000 },\n        .{ .x = 96,  .y = 0, .w = 32, .h = 32, .duration_ns = 80_000_000 },\n    },\n    .loop_mode = .loop,\n};\n\nvar animator = zsprite.Animator.init();\nanimator.play(\u0026walk);\n\n// Each frame\nconst dt_ns: u64 = 16_000_000; // 16ms\nconst frame = animator.update(dt_ns);\nif (frame) |f| {\n    // f.x, f.y, f.w, f.h — source rectangle on sprite sheet\n    drawSprite(sheet, f, screen_x, screen_y);\n}\n\n// Switch animations\nanimator.play(\u0026idle_animation);  // stops current, starts new\nanimator.pause();\nanimator.unpause();\n```\n\n```bash\nzig build test          # Run 40 tests\nzig build run-example   # Run example\n```\n\n## Example output\n\n```\n$ zig build run-example\nFrame 0: x=32, y=0, w=32, h=32\nFrame 1: x=64, y=0, w=32, h=32\nFrame 2: x=0, y=0, w=32, h=32\nPaused, playing=false\nResumed, playing=true\nIdle finished: true\n```\n\n## API\n\n### Frame\n\n| Field | Description |\n|-------|-------------|\n| `x, y` | Top-left corner on sprite sheet |\n| `w, h` | Frame dimensions |\n| `duration_ns` | How long to display this frame |\n\n### Animation\n\n| Field | Description |\n|-------|-------------|\n| `frames` | Slice of Frame |\n| `loop_mode` | `.once`, `.loop`, or `.ping_pong` |\n\n### Animator\n\n| Method | Description |\n|--------|-------------|\n| `init()` | Create animator |\n| `play(animation)` | Start playing an animation |\n| `pause()` | Pause at current frame |\n| `resume()` | Resume from pause |\n| `update(dt_ns)` | Advance time, returns `?Frame` (current frame) |\n| `frame()` | Current frame (may be null) |\n| `frameIndex()` | Current frame index |\n| `progress()` | Overall progress 0.0 to 1.0 |\n| `finished` | `true` when `.once` animation completes |\n| `playing` | `true` when actively playing |\n\n### Loop modes\n- `.once` — play once, set `finished = true` at end\n- `.loop` — loop forever (never sets `finished`)\n- `.ping_pong` — play forward then backward, repeat\n\n## License\n\nMIT. Copyright (c) 2026 Alessandro De Blasis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziosprite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeblasis%2Fziosprite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziosprite/lists"}