cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

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.

	Use left and right keys to move,
	space bar to jump.
<canvas id="c"></canvas>
	var a = document.getElementsByTagName('canvas')[0];
	var b = document.body;
	var d = function(e) {
		return function() {
	// unprefix some popular vendor prefixed things (but stick to their original name)
	var AudioContext =
			window.AudioContext ||
	var requestAnimationFrame =
			window.requestAnimationFrame ||
			window.mozRequestAnimationFrame ||
			window.webkitRequestAnimationFrame ||
			window.msRequestAnimationFrame ||
			function(f) {
				setTimeout(f, 1000 / 30);
	// fix bug in safari: http://qfox.nl/weblog/218
	// auto resize (original) canvas. call `onresize(w,h) to limit the size of the canvas
	(window.onorientationchange = window.onresize = function(a) {
		var mw = Infinity;
		var mh = Infinity;
		var min = Math.min;
		return function(w, h) {
			if (arguments.length === 2) {
				mw = w;
				mh = h;
			a.style.width = (a.width = min(mw, innerWidth)) + 'px';
			a.style.height = (a.height = min(mh, innerHeight)) + 'px';
	var c = a.getContext('2d');
              html, body {
	margin: 0; 
	padding: 0; 
	border: 0; 

#c {
	display: block; 
 * An entry for JS1K, a competition to create 
 * a JavaScript demo within 1kb.
 * Unminified code is up on Github:
 * https://github.com/rvmook/js1k-just-a-happy-robot

function d(f,g,h){i=0;while(j=f.match(/\w\d*/g)[i++]){c.fillStyle=k[j[0]]||'#000';c.f(4*(+j[1]*l+((l-1)*-5)+g),4*(+j[2]+h),4*l*((j[3]|0)+1),4*((j[4]|0)+1))}return d}m=n=o=p=q=r=0;k={37:-1,39:s=t=1,32:'if(!n)n=o=-4;0',w:'#fff',1:u='057w',2:'1702w26w354w542w63b64',3:'6702w56w054',4:u+'022w1104b12w432w5202b53w34',5:u+'1004w012b11'};b.onkeyup=b.onkeydown=function(f){t=(p=f.type[6]?eval(k[f.keyCode])||p:f.keyCode>36?0:p)||t};c.f=c.fillRect;v='w18w7';w='00245300241115430000254300243';setInterval("x=a.width/4;y=(Math.max(232,x+32)/8)|0;c.f(z=0,0,x*4,A=a.height);B=m+p;C=Math.floor(1+(D+B)/8)%y;while(C<0)C=y+C;E=!+w[C];F=(A/8|0)-9;if(E&&r==F||r<F){m=B;q=E?F:F-9}r+=r>F?-r:o++;if(r>q&&o>0){n=o=0;r=q}G=s%18<9;l=t;d('w1063b4101b6101'+['w29w69',v+7,v+8,v+9][H=n?2:p?s%4:0],I=D-4,J=+'6645'[H]+r+(E&&G))('w106w2142b51b421',I=D-4,+'5455'[H]+J)('w00w80',I=D-4,+'7676'[H]+J);l=1;while(z<y){K=z++*8-m;while(K<-16)K+=y*8;while(K>x+8)K-=y*8;d('b0777w'+(k[w[z]]||['081w271w481w671b069','291w081w691w481'][+G])+'b',K,F+3)}s++",D=82)

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................