Skip to content

Instantly share code, notes, and snippets.

playground({
create: function() {
app.loadData(...);
},
ready: function() {
var app = new PLAYGROUND.Application({
preload: function() {
/* this is called before create and lets you silently load some assets */
this.loadData("objects/buildings", "objects/subObjects", "objects/townBuildingList");
},
@rezoner
rezoner / game.js
Last active August 29, 2015 14:18
save screen in playground.js
/* This will make you a screenshot for later usage whenever you want */
ENGINE.Game = {
showOptionsScreen: function() {
app.screenshot = this.app.layer.cache();
app.setState(ENGINE.Options);
}
@rezoner
rezoner / gist:ed86e0a72a13ef58fce5
Created April 3, 2015 18:40
Playground Plugins v3
/*
Here is a simple plugin that creates scanlines image
and draws it after everything has been rendered
I am still not sure what will be the standard for configuration.
*/
PLAYGROUND.Scanlines = function(app) {
@rezoner
rezoner / gist:65f8313b156fbd48d467
Created April 2, 2015 23:45
PLAYGROUND.Layer plugin
PLAYGROUND.Layer = {
plugin: true,
app: {
create: function(app, data) {
app.layer = cq().appendTo(app.container);
@rezoner
rezoner / gist:c8e0e9be86d74b36b2aa
Last active August 29, 2015 14:17
Playground.js + Three.js - draft 3
/*
I've decided there will be two levels of integration
1) You get loaders only. You have to create renderers and scenes manually.
2) You get loaders and magically bootstrapped Three.js
Below is level 2 integration example which renders a textured cube:
*/
@rezoner
rezoner / gist:5fd6de20d4a00775fe89
Created March 23, 2015 12:14
Playground - ThreeJS bootstrap plugin
/*
ThreeJS bootstrap plugin
Sets up three.js render for an application
Sets up separate camera and scene for each state
*/
playground.plugins.three = {
@rezoner
rezoner / gist:86b59077e39c42fdbf06
Created March 23, 2015 09:45
Playground with Three.js - draft 2
var app = playground({
use: {
"three": {
renderer: "webgl"
},
},
@rezoner
rezoner / gist:362b5da4f3d6e01c9442
Created March 22, 2015 19:48
Playground with Three.js - draft 1
var app = playground({
create: function() {
this.renderer = new THREE.WebGLRenderer();
document.body.appendChild(app.renderer.domElement);
},
@rezoner
rezoner / easings.js
Created March 2, 2015 17:27
One argument easing equations
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {