Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created March 27, 2013 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/5250708 to your computer and use it in GitHub Desktop.
Save enjalot/5250708 to your computer and use it in GitHub Desktop.
basic FSS canvas
{"description":"basic FSS canvas","endpoint":"","display":"div","public":true,"require":[{"name":"fss","url":"https://raw.github.com/wagerfield/flat-surface-shader/master/deploy/fss.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/yuKrWnb.png"}
//http://wagerfield.github.com/flat-surface-shader/
//https://github.com/wagerfield/flat-surface-shader
var container = d3.select("#display").node();
var renderer = new FSS.CanvasRenderer();
container.appendChild(renderer.element);
// 3) Create a Scene:
var scene = new FSS.Scene();
// 4) Create some Geometry & a Material, pass them to a Mesh constructor, and add the Mesh to the Scene:
var geometry = new FSS.Plane(200, 100, 4, 2);
var material = new FSS.Material('#444444', '#FFFFFF');
var mesh = new FSS.Mesh(geometry, material);
scene.add(mesh);
// 5) Create and add a Light to the Scene:
var light = new FSS.Light('#FF0000', '#0000FF');
scene.add(light);
// 6) Finally, render the Scene:
renderer.render(scene);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment