Malewitsch
So still inspired by the same exhibition now this work started from Malewitsch’s work Suprematist Composition: Airplane Flying but as I continued to work on it it grew bigger and bigger…
Click on the Stage – Just play a bit if you like. Or scroll down for a more detailed description on the adjustable parameters and how it works.
Check my flickr account for nice stuff I created with this tool.
This was built with Flash, which won’t run any more on most modern browsers which is why I have replaced the thing with a screenshot. Here is a direct link to the swf file if you’d like to do some web archeology.
Controls on/off – Show/Hide the whole Options panel
Clear – Clears the Stage
Overlap – Allow/Disallow overlapping of Shapes
Width/Height/Rotation – Adjust Width/Height/Rotation of the Shapes
Dirt – Decide how much the Rectangle should be transformed
Random Malewitsch Colors – Stick to the colors from Suprematist Composition: Airplane Flying being Red, Blue, Yellow and Black
Random Colors – Randomly pick a color with every click
Choose Color – Pick a color yourself by entering a HEX Code
Now just some words on the Script itself.
First some tribute to stuff I used:
Again Grant Skinners awesome seeded Random Class.
Keith Peters MinimalComps for the Controls.
And now just two snippets from my Source which might be interesting.
var test_width:uint = 1 + dist * 2;
var x:Number;
var y:Number;
if (dist_iteration < Math.pow(test_width,2)) {
do {
x = (dist_iteration % test_width) - dist;
y = Math.floor(dist_iteration / test_width) - dist;
dist_iteration++;
}
while(Math.abs(x)
This starts from a certain point 0,0 and then returns coordinates in concentric rectangles around the initial point. Combined with the next snippet (Collision detection) this was used to find an empty sport close to where you click.
The next snippets checks for an empty spot (white) on bitmap where a shape can be put. It could still use some work as it currently assumes that 0,0 is the same for the Bitmap and the Shape. It also only handles x,y and rotation applied to the shape, no scaling or other adjustments. But for now it does it’s job quite well.
public static function check(shape:Shape,bitmapData:BitmapData):Boolean {
var tempBmpData:BitmapData = new BitmapData(shape.width, shape.height, true, 0xFFFFFF);
var matrix:Matrix = new Matrix();
var rotation:Number = 2 * Math.PI * (shape.rotation / 360);
matrix.rotate(rotation);
matrix.translate(shape.width/2, shape.height/2);
tempBmpData.draw(shape,matrix);
var tempBmpDataSource:BitmapData = new BitmapData(shape.width, shape.height, true, 0xFFFFFF);
var matrix2:Matrix = new Matrix();
matrix2.translate(-shape.x+shape.width/2,-shape.y+shape.height/2);
tempBmpDataSource.draw(bitmapData, matrix2);
var empty:Boolean = tempBmpData.hitTest(new Point(0, 0), 0xFF, tempBmpDataSource, new Point(0, 0), 0xFF);
tempBmpData.dispose();
tempBmpDataSource.dispose();
return(empty)
}