Journal Entry

Tuesday, September 28, 2010

Boxy

Did I already post this? I don't believe I did. It's a little piece of stochastic abstract frame-based HTML web art I made:

Boxy

You can hit reload a bunch of times and get different pastel-Mondrian patterns, and you can drag to resize them, too.

What I like about this isn't so much the actual output, as the simplicity of the design -- you can see the very short, oddly recursive program code after the cut.

<html>
<?php 
  $chance = $_GET["chance"];
   
  if (rand(0,99) < $chance) {
    	$red = rand(0,255);
	$green = rand(0,255);
	$blue = rand(0,255);
	$rgb = "rgb(".$red.",".$green.",".$blue.")";	

?>
  <head>
	<style> body { background-color: <?php echo($rgb); ?>; } </style>
  </head>
  <body></body>
<?php 
  } else {
    $what = (rand(0,99) < 50) ? "rows" : "cols";
	$url = $_SERVER[SCRIPT_URL]."?chance=".($chance + 8);
 ?>
   <frameset <?php echo($what); ?>="50%,50%">
	  <frame scrolling="no" src="<?php echo($url) ?>&a=<?php echo(rand()); ?>" />
	  <frame scrolling="no" src="<?php echo($url) ?>&b=<?php echo(rand()); ?>" />
   </frameset>
<?php 
  }
?>    
</html>   
Posted by benrosen at September 28, 2010 04:07 PM | Up to blog
Comments

Cool!

But when I dragged to resize, I got an error message that was partially covered by the design, so I couldn't read it.

-Mom

Posted by: Karen Rosenbaum at September 29, 2010 12:33 AM

Next step? Write it in this language:
http://www.dangermouse.net/esoteric/piet/samples.html

Posted by: jamesG at September 29, 2010 05:30 AM

jamesG: that is one cool language!

Mom: how odd, I never got an error resizing. If you get it again, you could right-click on a character, choose "select all" (or press ctrl-A) and then copy, and send it to me...

Posted by: Benjamin Rosenbaum at September 29, 2010 07:20 AM
Post a comment









Please choose one:


Thank you. Remember personal info?