{"id":13618115,"url":"https://github.com/edbentley/replay","last_synced_at":"2025-04-14T10:31:11.848Z","repository":{"id":42986214,"uuid":"260674431","full_name":"edbentley/replay","owner":"edbentley","description":"A cross-platform JS game engine inspired by React","archived":false,"fork":false,"pushed_at":"2025-01-03T17:23:42.000Z","size":9562,"stargazers_count":298,"open_issues_count":8,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T22:44:42.337Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://replay.js.org","language":"TypeScript","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/edbentley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-02T11:40:35.000Z","updated_at":"2025-02-20T22:03:34.000Z","dependencies_parsed_at":"2024-01-14T08:12:05.992Z","dependency_job_id":"68146693-5b5e-4bc2-9b44-6438eece413f","html_url":"https://github.com/edbentley/replay","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edbentley%2Freplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edbentley%2Freplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edbentley%2Freplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edbentley%2Freplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edbentley","download_url":"https://codeload.github.com/edbentley/replay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248862593,"owners_count":21173837,"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":[],"created_at":"2024-08-01T20:01:54.695Z","updated_at":"2025-04-14T10:31:06.837Z","avatar_url":"https://github.com/edbentley.png","language":"TypeScript","readme":"\u003cimg src=\"https://user-images.githubusercontent.com/15923595/80867852-59ea6680-8c8e-11ea-93ee-a17b922239f2.png\" alt=\"Replay\" align=\"center\" width=\"250\" /\u003e\n\nReplay is a cross-platform JavaScript game engine inspired by\n[React](https://reactjs.org/).\n\nIts declarative API goes against the grain of typical game engines. It's small\nyet powerful, giving you total control on how your game runs. With a great\ntesting library built in, Replay is ideal for writing bug-free games.\n\nBuild your game once and deploy it for web, iOS and Android.\n\n[Tutorial](https://replay.js.org/tutorial) ·\n[Docs](https://replay.js.org/docs/intro) · [Blog](https://replay.js.org/blog) ·\n[Games](https://replay.js.org/games)\n\n## ⚠️ Status\n\nReplay is still in early development and will go through many breaking changes.\nHowever we encourage you to start making games now - your feedback will help\nshape Replay's future!\n\n## Quick Setup\n\nCreate a file, copy this in and open it in a browser:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n  \u003c!-- Load Replay through a CDN --\u003e\n  \u003cscript src=\"https://unpkg.com/@replay/core@0.10.0/umd/replay-core.min.js\"\u003e\u003c/script\u003e\n  \u003cscript src=\"https://unpkg.com/@replay/web@0.10.0/umd/replay-web.min.js\"\u003e\u003c/script\u003e\n  \u003ctitle\u003eReplay Game\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript\u003e\n\n// Import from Replay\nconst { makeSprite, t } = replay;\nconst { renderCanvas } = replayWeb;\n\n// Setup game size\nconst gameProps = {\n  id: \"Game\",\n  size: {\n    landscape: {\n      width: 600,\n      height: 400,\n      maxWidthMargin: 150,\n    },\n    portrait: {\n      width: 400,\n      height: 600,\n      maxHeightMargin: 150,\n    },\n  },\n  defaultFont: {\n    family: \"Courier\",\n    size: 10,\n  },\n};\n\n// Create a Game Sprite\nconst Game = makeSprite({\n  init() {\n    // Our initial state\n    return {\n      posX: 0,\n      posY: 0,\n      targetX: 0,\n      targetY: 0,\n    };\n  },\n\n  // This is run 60 times a second. Returns next frame's state.\n  loop({ state, getInputs }) {\n    const { pointer } = getInputs();\n    const { posX, posY } = state;\n    let { targetX, targetY } = state;\n\n    // Update our target when the mouse is clicked\n    if (pointer.justPressed) {\n      targetX = pointer.x;\n      targetY = pointer.y;\n    }\n\n    return {\n      // Update our position to move closer to target over time\n      posX: posX + (targetX - posX) / 10,\n      posY: posY + (targetY - posY) / 10,\n      targetX,\n      targetY,\n    };\n  },\n\n  // Render Textures based on game state\n  render({ state }) {\n    return [\n      t.text({\n        color: \"red\",\n        text: \"Hello Replay!\",\n        y: 50,\n      }),\n      t.circle({\n        x: state.posX,\n        y: state.posY,\n        color: \"#147aff\",\n        radius: 10,\n      }),\n    ];\n  },\n});\n\n// Render in the browser using canvas\nrenderCanvas(Game(gameProps), { dimensions: \"scale-up\" });\n\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n","funding_links":[],"categories":["TypeScript","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedbentley%2Freplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedbentley%2Freplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedbentley%2Freplay/lists"}