"; } if( $text == "" ){ $error .= "Please fill something in the textbox.
"; } if( strtoupper( $_POST["captcha"] ) != $_SESSION["ANTI_SPAM"] ){ $error .= "You seem to be a spammer. Sorry if that's wrong. Please re-enter the captcha code!
"; } $name = str_replace( ",", ",-", $name ); $url = str_replace( ",", ",-", $url ); $text = str_replace( ",", ",-", $text ); mail( "super@superduper.org", "msp5/new comment", "$name\n$url\n$text\n" ); if( $error == "" ){ $file = fopen( "comments.txt", "a" ); fwrite( $file, str_replace( "\n", "
", str_replace( "\r", "", time() . ",,$name,,$url,,$text" ) ) . "\n" ); fclose( $file ); $code = ""; for( $i = 0; $i < 4; $i++ ){ $code .= chr( rand( 65, 90 ) ); } $_SESSION["ANTI_SPAM"] = $code; // clear the post array $_POST = array(); $error = "Your comment was added!"; } else{ // hm... error will be displayed below } } ?> MetaSurface for Processing

What is this?

MetaSurface is a library for processing that allows you to easily control multiple parameters and whole sets of those. Additionally you can fade smoothly from one set to another, record changes of settings over time, play those back again and export your sketch to video. If that description wasn't helpful at all you might just want to try the demo below.

Getting Started

First download the latest version and extract it to sketch-folder/libraries/. (Re-)start Processing. If everything went okay you should now have a few examples in
File » Sketchbook » Libraries » Examples » MetaSurface.

Command Reference

metaSurface = new MetaSurface(this, labels[], minValues[], maxValues[], defaultValues[] )
Creates a new metasurface object.
metaSurface.values[i]
Access the current value as set by the metasurface
metaSurface.open( "filename" )
Opens a file with user-generated parameter sets. The user has an open button to do the same, but you can use this to present a default option.
If you pass null an open-dialog will be shown to the user.
metaSurface.save( "filename" )
Saves a file with user-generated parameter sets. The user has a save button to do the same, but you can use this to save the settings automatically (for instance when the sketch exits).
If you pass null the currently opened file's name will be used for saving.

Thanks, attribution and such...

As one might have figured this project isn't all that unique. Even more so, it was created when I needed something like Audiomulch's metasurface, but to control a processing sketch instead of an audio patch (har har).
So a big thanks also goes to Francesco Meneghini, who led the original project that resulted in this code, for letting me open source the it.

Example Usage

import metasurface.*;

// If you don't want to use the "export sketch to movie" functionality
// built into the metasurface disable the following line: 
import processing.video.*; 

float t; 
float rotX, rotY; 
float rotXSpeed, rotYSpeed; 
float amplitude;

MetaSurface surface; 

void setup(){
  size( 200, 200, P3D ); 

  // Create the meta surface object
  surface = new MetaSurface(
    this, 
    new String[]{ "Rotation speed X", "Rotation speed y", "Amplitude" }, // Labels
    new float[]{ -.1, -.1,  0 },  // Minimum Values
    new float[]{  .1,  .1, 90 },  // Maximum Values
    new float[]{   0,   0, 90 }   // Default Values
  );
}

void draw(){
  rotXSpeed = surface.values[0];  // Access first value
  rotYSpeed = surface.values[1];  // Access second value
  amplitude = surface.values[2];  // Access third value
  
  // now do some drawing with those parameters
  background( 255 ); 
  
  lights();   
  noStroke(); 
  fill( 150 ); 
  t += 0.1;
  rotX += rotXSpeed; 
  rotY += rotYSpeed;  
  
  translate( width/2, height/2 ); 
  rotateX( rotX ); 
  rotateY( rotY ); 
  for( int x = -50; x < 50; x += 5 ){
    for( int y = -50; y < 50; y += 5 ){
      pushMatrix(); 
      translate( x, y ); 
      box( 5, 5, f( x, y ) ); 
      popMatrix(); 
    }
  }
}


float f( float x, float y ){
  return amplitude * sin( x + t ) * cos( x*x ) * cos( y/4 + t ); 
}

Feedback

$url"; echo "
$name $date $text
"; } } comments( "comments.txt" ); ?>


$img = imagecreate( 100, 35 ); $white = imagecolorallocate( $img, 255, 255, 255 ); $black = imagecolorallocate( $img, 0, 0, 0 ); imagefill( $img, $white, 0, 0 ); imagettftext( $img, 22, 0, 15, 35, $black, realpath( "f_bm_neco.ttf" ), $_SESSION["ANTI_SPAM"] ); ob_start(); imagepng( $img ); $content = ob_get_contents(); ob_end_clean(); echo ""; ?>