Skip to content

Instantly share code, notes, and snippets.

@phinze
Created November 30, 2009 05:04
Show Gist options
  • Save phinze/245266 to your computer and use it in GitHub Desktop.
Save phinze/245266 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>A Processing.js Example</title>
<script type="text/javascript" src="js/processing.js"></script>
<script type="text/javascript" src="js/init.js"></script>
</head>
<body>
<script type="application/processing">
size(600, 200);
background(102);
PFont fontA = loadFont("Arial");
textFont(fontA, 32);
int x = 10; y = 50;
fill(0);
lineHeight = 40;
String localVar = "i am a local variable";
text(localVar,x,y);
y += lineHeight;
String localFile = loadStrings("oneLine.txt");
text(localFile,x,y);
y += lineHeight;
String remoteFile = loadStrings("http://sandbox.phinze.com/processing-js/load_strings/otherLine.txt");
text(remoteFile,x,y);
</script>
<canvas></canvas>
</body>
</html>
hello world local file here
hello world file loaded via full URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment