{"id":14963979,"url":"https://github.com/cristianbote/phaser-state-transition","last_synced_at":"2025-04-07T06:12:04.460Z","repository":{"id":13512050,"uuid":"16203028","full_name":"cristianbote/phaser-state-transition","owner":"cristianbote","description":"State transition plugin for Phaser.js","archived":false,"fork":false,"pushed_at":"2020-01-02T17:58:40.000Z","size":393,"stargazers_count":175,"open_issues_count":3,"forks_count":24,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-30T22:11:09.129Z","etag":null,"topics":["javascript","phaser","phaser-plugin","phaserjs","pixijs","plugin","state-transition","transition"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ty4z2008/Qix","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cristianbote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["cristianbote"]}},"created_at":"2014-01-24T11:49:29.000Z","updated_at":"2024-07-02T09:34:41.000Z","dependencies_parsed_at":"2022-08-31T05:21:45.227Z","dependency_job_id":null,"html_url":"https://github.com/cristianbote/phaser-state-transition","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristianbote%2Fphaser-state-transition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristianbote%2Fphaser-state-transition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristianbote%2Fphaser-state-transition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristianbote%2Fphaser-state-transition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristianbote","download_url":"https://codeload.github.com/cristianbote/phaser-state-transition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":["javascript","phaser","phaser-plugin","phaserjs","pixijs","plugin","state-transition","transition"],"created_at":"2024-09-24T13:32:25.283Z","updated_at":"2025-04-07T06:12:04.425Z","avatar_url":"https://github.com/cristianbote.png","language":"JavaScript","funding_links":["https://github.com/sponsors/cristianbote"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"State Transition Plugin for Phaser\n=======================\n[![npm version](https://badge.fury.io/js/phaser-state-transition.svg)](https://badge.fury.io/js/phaser-state-transition)\n\n## About\nCurrently the switch between states is really static and a game should be able to transition between states. Therefore, this plugin does exactly that: draws the `game.world` into a `renderTexture` which is rendered on a `sprite`, and finally it's tweening that sprite.\n\n## Transition Examples\n\n![](https://i.imgur.com/Kgzc24u.gif)\n\nhttps://codepen.io/cristianbote/full/GjgVxg\n\n## How to use it\nYou have several options here including es6 imports.\n \n### Npm\n\n```bash\nnpm install phaser-state-transition --save\n```\n\nAnd then import it in your project\n\n```js\nimport \"phaser-state-transition\";\n```\n\nThe plugin needs the `Phaser` framework to work, therefore you should make sure that this is included before the plugin's import.\n\n#### Straight but nor recommended\nJust download the `dist/phaser-state-transition.umd.js` file and you're done, but this is not the recommended way. You should use it via npm. You have better control on what version you're keeping locally.\n\n## Usage\nThe easiest way to use it, is by just passing a transition for entering.\n\n```js\nimport { createTransition } from \"phaser-state-transition\";\n\nconst EnteringTransition = createTransition({\n    props: {\n        x: game =\u003e game.width\n    }\n});\n\ngame.state.start(\"stateName\", EnteringTransition);\n```\n\nThe transition options to pass in are basically just some instructions for the plugin, to handle the _how_ of the transition. You'll find there are other properties inside, like ease, duration and other properties that are not that important to have nice transitions.\n\n## API\n\n### StateTransitionPlugin\nThe plugin class. Normally you should not work on this class, but you could extend it if needed. The plugin does not need a class to be working. \n\n### createTransition(options)\nThis helper function, generates a transition object to be passed along the `game.state.start` method.\n\nThe default duration would be `500ms` and the ease function `Phaser.Easing.Exponential.InOut`\n\n* `@param {object} options` The options to create a transition object\n* `@returns {object}` The transition object to be passed along the `game.start.state`\n\n\n## Feedback\nIf there's something you think it could be improved let me know, or create a pr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristianbote%2Fphaser-state-transition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristianbote%2Fphaser-state-transition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristianbote%2Fphaser-state-transition/lists"}