Code Monkey home page Code Monkey logo

phaser-state-transition's Introduction

State Transition Plugin for Phaser

Plugin for phaser.js(http://phaser.io/) v 1.1.4

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. source: src/phaser-state-transition.js build(minified): build/phaser-state-transition.min.js

Usage

Take a look inside demo folder. It's pretty straight forward. The easiest way is to add the plugin into your game, keep a reference to it, and call:

//add the plugin
var transitionPlugin = game.plugins.add(Phaser.Plugin.StateTransition);

//define new properties to be tweened, duration, even ease
transitionPlugin.settings({

	//how long the animation should take
	duration: 1000,

	//ease property
	ease: Phaser.Easing.Exponential.InOut, /* default ease */

	//what property should be tweened
	properties: {
		alpha: 0,
		scale: {
			x: 1.5,
			y: 1.5
		}
	}
});

//and later on
transitionPlugin.to("yourStateName");

Feedback

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

phaser-state-transition's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.