A recreation of the Battle of Yavin using threejs.
Explosions: http://codepen.io/Xanmia/pen/DoljI Planets: https://github.com/jeromeetienne/threex.planets
A Pen by Carson Britt on CodePen.
| /* | |
| * A concatination and minification of THREE.js shaders and postprocessing scripts | |
| * these are not included in the core threejs package, | |
| * the purpose of this gist is to simplify including multiple scripts on codepen. | |
| */ | |
| //http://threejs.org/examples/js/shaders/CopyShader.js | |
| THREE.CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")}; | |
| //http://threejs.org/examples/js/shaders/RGBShiftShader.js | |
| THREE.RGBShiftShader={uniforms:{tDiffuse:{type:"t",value:null},amount:{type:"f",value:.005},angle:{type:"f",value:0}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( posi |
A recreation of the Battle of Yavin using threejs.
Explosions: http://codepen.io/Xanmia/pen/DoljI Planets: https://github.com/jeromeetienne/threex.planets
A Pen by Carson Britt on CodePen.
| ul.controls | |
| li: button#info Info | |
| li: button#reset Generate | |
| li: button#options Options | |
| .info.module.hidden | |
| p Change some options and regenerate the city! | |
| .options.module.hidden | |
| section |
| { | |
| "version":"4.2.2", | |
| "database":{ | |
| "dbhost":"127.0.0.1:3306", | |
| "dbuser":"DB_USER", | |
| "dbname":"DB_NAME", | |
| "dbpass":"DB_PASS" | |
| }, | |
| "plugins": [ | |
| { "name":"wordpress-importer", "version": "0.6.1" } |
| body { | |
| margin: 0; | |
| } | |
| .athing a:visited { | |
| color: #B2B2B2; | |
| } | |
| #hnmain { | |
| width: 100%; |
| import os | |
| from PIL import Image | |
| from os.path import dirname | |
| import_dir = './' | |
| output_dir = './' | |
| img_count = 0 | |
| file_count = 0 | |
| resize_count = 0 |
| import os | |
| from os.path import dirname | |
| from urllib2 import Request, urlopen | |
| from base64 import b64encode | |
| compress_png = True | |
| compress_jpg = True | |
| import_dir = '<INPUT DIR>' | |
| output_dir = "<OUTPUT DIR>" | |
| tiny_png_key = '<API KEY>' |
| // Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/ | |
| var metas = document.getElementsByTagName('meta'); | |
| var i; | |
| if (navigator.userAgent.match(/iPhone/i)) { | |
| for (i=0; i<metas.length; i++) { | |
| if (metas[i].name == "viewport") { | |
| metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; | |
| } | |
| } |
| //ga click helper | |
| $('[data-tracking]').on('click', function(){ | |
| var track_string = $(this).data('tracking').toLowerCase(); | |
| if(!track_string){return false;} | |
| var track_arr = track_string.split(","); | |
| if(track_arr.length < 2){return false;} | |
| var category = track_arr[0]; | |
| var action = track_arr[1]; |
| const char BUTTON_CHARS[] = {(char)48, (char)49, (char)50, (char)51}; | |
| const int BUTTON_COUNT = 4; | |
| const int BUTTON_PINS[] = {4, 5, 6, 7}; | |
| int button_states[] = {0, 0, 0, 0}; | |
| int button_last_states[] = {0, 0, 0, 0}; | |
| void setup() { | |
| pinMode(BUTTON_PINS[0], INPUT); | |
| pinMode(BUTTON_PINS[1], INPUT); | |
| pinMode(BUTTON_PINS[2], INPUT); |