Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <script src=""></script>
<div id="phaser-example"></div>




 * This scripts tests yo yo tweening applied on Phaser text. One on fontSize and another on scale of the text element.
 * Please test this script in different browsers.
 * In OSX Chrome both texts appear to tween smoothly while the one with fontSize tweened might appear lagged in certain browsers including OSX Safari, Android Chrome.

// First, we declare a global instance of Phaser class. We are explicityly specifying CANVAS this time. See Phaser.Game for details
var game = new Phaser.Game(800,600,Phaser.CANVAS,'phaser-example',{'create': create});

// Making A global variable to keep anyting in.
var stackBin = {};

// Here we declare a global function for the create state of Phaser instance declared right above.
function create() {
	 * Preparing all the pieces we need for testing
	stackBin.text = {
		'styles': {},
		'lines': {},

	// text style to be used for the test text
	stackBin.text.styles.default = { font: "22px Arial", fill: "#ff0044", align: "center" };

	// we will have two text elements here for testing.
	stackBin.text.lines.usingFontSize = game.add.text(, - 100, "TEXT YOYO TWEEN WITH fontSize", stackBin.text.styles.default);
	stackBin.text.lines.usingScale = game.add.text(, + 100, "TEXT YOYO TWEEN WITH scale", stackBin.text.styles.default);

	// I am lazy. Using loop to set the same thing to all in the object branch of stackBin.text.lines
	for (var _key in stackBin.text.lines ) {
		stackBin.text.lines[_key].anchor.setTo(0.5, 0.5);

	// now add tween to the text lines manually
	// test using font size
	game.add.tween(stackBin.text.lines.usingFontSize).to({fontSize: 28,},0, Phaser.Easing.Linear.None, true, 1000, -1, true);
	// test yo yo tweening font scale of the element
	game.add.tween(stackBin.text.lines.usingScale.scale).to({x: 1.22, y: 1.2},0, Phaser.Easing.Linear.None, true, 1000, -1, true);