{"id":17351403,"url":"https://github.com/frostney/react-spritesheet","last_synced_at":"2025-04-14T20:31:22.818Z","repository":{"id":57345173,"uuid":"53786692","full_name":"frostney/react-spritesheet","owner":"frostney","description":"Spritesheets for React","archived":false,"fork":false,"pushed_at":"2017-03-23T11:38:07.000Z","size":12,"stargazers_count":34,"open_issues_count":4,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:47:35.564Z","etag":null,"topics":["react","sprite","sprites","spritesheet"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frostney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-13T13:34:16.000Z","updated_at":"2025-03-29T03:27:44.000Z","dependencies_parsed_at":"2022-09-16T18:11:44.532Z","dependency_job_id":null,"html_url":"https://github.com/frostney/react-spritesheet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-spritesheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-spritesheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-spritesheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-spritesheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frostney","download_url":"https://codeload.github.com/frostney/react-spritesheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248955538,"owners_count":21189154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["react","sprite","sprites","spritesheet"],"created_at":"2024-10-15T17:09:49.135Z","updated_at":"2025-04-14T20:31:22.503Z","avatar_url":"https://github.com/frostney.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-spritesheet\nSpritesheets for React\n\n## Installation\n\n```\nnpm install react-spritesheet\n```\n\n## Usage\nThis module exports three components:\n\n### Sprite\nThis component is for displaying a part of a bigger image - a rectangular cutout as you will.\n\n```jsx\n\u003cSprite filename=\"hello.png\" x={40} y={40} width={40} height={40} /\u003e\n```\n\n#### Props\n\n##### filename\n###### Type: `String`\n\nThe filename of the image to be displayed\n\n##### x\n###### Type: `Number`\n\nThe x offset of the image\n\n##### y\n###### Type: `Number`\n\nThe y offset of the image\n\n##### width\n###### Type: `Number`\n\nThe width of the image that will be displayed\n\n##### height\n###### Type: `Number`\n\nThe height of the image that will be displayed\n\n### SpriteSheet\nProviding an image and a spritesheet object, this will display an image from the pre-defined object.\n\n```jsx\nconst spriteSheet = {\n  image1: {\n    x: 0,\n    y: 0,\n    width: 100,\n    height: 100,\n  },\n  image2: {\n    x: 100,\n    y: 0,\n    width: 100,\n    height: 100,\n  },\n};\n\n\u003cSpriteSheet filename=\"myimage.png\" data={spriteSheet} sprite=\"image1\" /\u003e\n```\n\nFor generating a spritesheet object, take a look at [TexturePacker](https://www.codeandweb.com/texturepacker) or [spritesmith](https://github.com/Ensighten/spritesmith).\n\n#### Props\n\n##### filename\n###### Type: `String`\n\nThe filename of the image to be displayed\n\n##### data\n###### Type: `Object`\n\nThe spritesheet object, to be in the form of:\n```json\n{\n  \"\u003cname\u003e\": {\n    \"x\": 0,\n    \"y\": 0,\n    \"width\": 0,\n    \"height\": 0\n  }\n}\n```\n\n##### sprite\n###### Type: `String`\n\nThe name of the sprite that should be displayed\n\n### AnimatedSpriteSheet\nSimilar to `Sprite`, but displays one sprite after another at a particular speed.\n\n```jsx\n\u003cAnimatedSpriteSheet\n  filename=\"myimage.png\"\n  initialFrame={0}\n  frame={{ width: 120, height: 120 }}\n  bounds={{ x: 0, y: 0, width: 480, height: 120 }}\n  isPlaying\n  loop\n  speed={300}\n/\u003e\n```\n\n#### Props\n\n##### filename\n###### Type: `String`\n\nThe filename of the image to be displayed\n\n##### initialFrame\n###### Type: `Number`\n###### Default: `0`\n\nThe initial frame of the image\n\n##### frame\n###### Type: `Object`\n\nThe dimensions of a single frame\n\n##### bounds\n###### Type: `Object`\n\nThe bounds of the image that will be used for displaying one frame after another.\n\n##### isPlaying\n###### Type: `Boolean`\n###### Default: `true`\n\nDetermines if the spritesheet is actually playing.\n\n##### loop\n###### Type: `Boolean`\n###### Default: `true`\n\nLoops through the animation\n\n##### speed\n###### Type: `Number`\n###### Default: `300`\n\nThe speed (in milliseconds) of displaying one frame after another\n\n## Example\n\nSee `example/index.html`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostney%2Freact-spritesheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrostney%2Freact-spritesheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostney%2Freact-spritesheet/lists"}