Not one for Martin!
ß e n
/**
* sojudy v1.0
*/
//
// Dimensions of screen.
//
int kWidth = 640 ; //480 ;
int kHeight = 480 ; // 480 ; // 320 ;
//
// Dimensions of texture.
//
int kTextureWidth = kWidth ;
int kTextureHeight = kHeight ;
//
// Define a history buffer of screen textures.
//
PImage history = createImage( kTextureWidth, kTextureHeight, RGB ) ;
void setup()
{
size( kWidth, kHeight, JAVA2D ) ;
colorMode( RGB, 1.0 ) ;
}
void draw()
{
float t = millis() * 0.001 ;
//
// Feedback!
//
pushMatrix() ;
translate( width/2, height/2 ) ;
rotate( t * 0.0003* sin(t) ) ;
scale( 1.04 ) ;
image( history, -width/2, -height/2, kWidth, kHeight ) ;
popMatrix() ;
//
// Colour blast.
//
for ( int j = 0 ; j < 8 ; ++ j )
{
pushMatrix() ;
if ( true )
{
translate( width/2 + width*0.020*sin(t), height/2 + height*0.020*sin(t*1.37) ) ;
rotate( 2.0*PI*j/8.0 ) ;
translate( width * 0.05, 0.0 ) ;
}
else
{
float dx = width* 0.25 * ( 0.5 - noise(t,0, j ) ) ;
float dy = height* 0.25 * ( 0.5 - noise(t,0, j ) ) ;
translate( width/2 + dx, height/2 + dy ) ;
}
// translate( width/2 + width*0.20*sin(t), height/2 + height*0.20*sin(t*1.37) ) ;
noStroke() ;
fill( noise(t,0,j), noise(t,1,j), noise(t,2,j), 0.1 ) ;
beginShape() ;
for ( int i = 0 ; i < 100 ; ++ i )
{
float x = width * 0.25 * ( 0.5 - 1.0 * noise( t, 1.5 + 0, i * 0.1 ) ) ;
float y = height * 0.25 * ( 0.5 - 1.0 * noise( t, 1.5 + 1, i * 0.1 ) ) ;
vertex( x, y ) ;
}
endShape() ;
popMatrix() ;
}
//
// Black smoke.
//
if ( true )
{
pushMatrix() ;
translate( width/2, height/2 ) ;
for ( int j = 0 ; j < 5 ; ++ j )
{
fill( 0, 0, 0, 0.1 ) ;
beginShape() ;
for ( int i = 0 ; i < 100 ; ++ i )
{
float x = width * 0.15 * ( 0.5 - 1.0 * noise( t, 1.5 + 0, j*100 + i * 0.1 ) ) ;
float y = height * 0.15 * ( 0.5 - 1.0 * noise( t, 1.5 + 1, j*100 + i * 0.1 ) ) ;
vertex( x, y ) ;
}
endShape() ;
}
popMatrix() ;
}
//
// Use the current frame as a texture.
//
history.copy( get(), 0, 0, width, height, 0, 0, kTextureWidth, kTextureHeight ) ;
}
2 comments:
Yeah I much prefer the Mirror of Confusion, which I fancy having a go at translating into ruby-processing. It's not the colors, it just the sketch looks a bit 'muddy' compared to some of you other excellent efforts...
Yeah, I think the problem with the colours might be down to using millisecond time for the animation. I can get it to look nice on my iMac but on a PC running at a different speed the results will look very different. Switching to frameCount will give more consistent results I think!
Thanks for your kind comments by the way!
ß e n
Post a Comment