All Projects → cristianbote → Phaser State Transition

cristianbote / Phaser State Transition

Licence: mit
State transition plugin for Phaser.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Phaser State Transition

Phaser Kinetic Scrolling Plugin
Kinetic Scrolling plugin for Canvas using Phaser Framework
Stars: ✭ 117 (-30.77%)
Mutual labels:  phaser, phaserjs, pixijs
Opensc2k
OpenSC2K - An Open Source remake of Sim City 2000 by Maxis
Stars: ✭ 4,753 (+2712.43%)
Mutual labels:  phaser, phaserjs
Phaser3 Docs
Phaser 3 Documentation and TypeScript Defs
Stars: ✭ 339 (+100.59%)
Mutual labels:  phaser, phaserjs
Slither.io Clone
Learn how to make Slither.io with JavaScript and Phaser! This game clones all the core features of Slither.io, including mouse-following controls, snake collisions, food, snake growth, eyes, and more. Progress through each part of the source code with our Slither.io tutorial series.
Stars: ✭ 168 (-0.59%)
Mutual labels:  phaser, phaserjs
phaser-3-palette-swapping-example
Example of using palette swapping on a spritesheet in Phaser 3.
Stars: ✭ 32 (-81.07%)
Mutual labels:  phaser, phaserjs
generator-phaser-browserify
A generator for Phaser using Gulp and Browserify
Stars: ✭ 36 (-78.7%)
Mutual labels:  phaser, phaserjs
Phaser
Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
Stars: ✭ 30,918 (+18194.67%)
Mutual labels:  phaser, phaserjs
anim8js
The ultimate animation library for javascript - animate everything!
Stars: ✭ 33 (-80.47%)
Mutual labels:  transition, pixijs
Obs Streamfx
StreamFX is a plugin for OBS Studio which adds many new effects, filters, sources, transitions and encoders - all for free! Be it 3D Transform, Blur, complex Masking, or even custom shaders, you'll find it all here.
Stars: ✭ 1,128 (+567.46%)
Mutual labels:  plugin, transition
Easygameframeworkopen
基于Typescript的渐进式通用游戏前端开发框架
Stars: ✭ 65 (-61.54%)
Mutual labels:  phaser, pixijs
blocker
🎮 (WIP - phase 3) Multiplayer online game using Phaser + WebSocket (Socket.IO)
Stars: ✭ 48 (-71.6%)
Mutual labels:  phaser, phaserjs
Phaser Examples
🎮 Game collections made by Phaser
Stars: ✭ 140 (-17.16%)
Mutual labels:  phaser, phaserjs
gstatsjs
Graphics statistic (DrawCalls and TextureCount) for WebGL
Stars: ✭ 48 (-71.6%)
Mutual labels:  phaser, pixijs
Generator Phaser
A yeoman generator for phaser games
Stars: ✭ 255 (+50.89%)
Mutual labels:  phaser, phaserjs
phaser-starter
Minimal starter project to get a Phaser game environment up and running with ease.
Stars: ✭ 73 (-56.8%)
Mutual labels:  phaser, phaserjs
Webpack Starter Basic
A simple webpack starter project for your basic modern web development needs.
Stars: ✭ 552 (+226.63%)
Mutual labels:  phaser, phaserjs
phaser-particle-editor-plugin
This plugin creates particles based on JSON data generated by Phaser Particle Editor
Stars: ✭ 28 (-83.43%)
Mutual labels:  phaser, phaserjs
craft
Phaser Library with utility chainable functions
Stars: ✭ 27 (-84.02%)
Mutual labels:  phaser, phaserjs
Phaser Node Kit
Rapid Game Development with PhaserJS and Node for Modern Browsers
Stars: ✭ 39 (-76.92%)
Mutual labels:  phaser, phaserjs
Creature webgl
2D Skeletal Animation WebGL Runtimes for Creature ( PixiJS, PhaserJS, ThreeJS, BabylonJS, Cocos Creator )
Stars: ✭ 140 (-17.16%)
Mutual labels:  phaser, pixijs

State Transition Plugin for Phaser

npm version

About

Currently 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.

Transition Examples

https://codepen.io/cristianbote/full/GjgVxg

How to use it

You have several options here including es6 imports.

Npm

npm install phaser-state-transition --save

And then import it in your project

import "phaser-state-transition";

The plugin needs the Phaser framework to work, therefore you should make sure that this is included before the plugin's import.

Straight but nor recommended

Just 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.

Usage

The easiest way to use it, is by just passing a transition for entering.

import { createTransition } from "phaser-state-transition";

const EnteringTransition = createTransition({
    props: {
        x: game => game.width
    }
});

game.state.start("stateName", EnteringTransition);

The 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.

API

StateTransitionPlugin

The 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.

createTransition(options)

This helper function, generates a transition object to be passed along the game.state.start method.

The default duration would be 500ms and the ease function Phaser.Easing.Exponential.InOut

  • @param {object} options The options to create a transition object
  • @returns {object} The transition object to be passed along the game.start.state

Feedback

If there's something you think it could be improved let me know, or create a pr.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].