Archive for the 'experiments' Category

Sand Dollar - Fast Drawing

Sunday, September 14th, 2008

This is another sketch I did while developing my library for fast drawing. It is made up of 5,000 transparent squares.

It reminds me of a sand dollar:




Click either of the above images to see the flash version

The transparent squares are placed in a circular formation using polar coordinates. The squares can be pushed/separated with the mouse.

Swim - Fast Drawing

Saturday, September 13th, 2008

Using copyPixels to draw is very fast. If your code is set up correctly you can draw thousands of small graphics to the screen - this would be impossible using sprites, shapes etc…

Over the next couple of weeks I’ll be posting some of the sketches I created while developing a small library for handling this kind of drawing. This first one is a texture made up of 500 oscillating transparent circles that are attracted to the mouse…




Click either of the above images to see the flash version

Abstract Curtain

Friday, September 12th, 2008



Click the above image to view the flash version

This uses a BitmapData technique that I first encountered in Director Imaging Lingo. Try this code out:

Actionscript:
  1. stage.frameRate = 31;
  2. var canvas:BitmapData = new BitmapData(500,500, true, 0xFF000000);
  3. // transparent black overlay
  4. var overlay:BitmapData = new BitmapData(500,500,true, 0x11000000);
  5. addChild(new Bitmap(canvas));
  6.  
  7. var brush:Shape = new Shape();
  8. brush.graphics.beginFill(0xFFFFFF,0.5);
  9. brush.graphics.drawCircle(0,0,20);
  10.  
  11. addEventListener(Event.ENTER_FRAME, onLoop);
  12. function onLoop(evt:Event):void {
  13.     brush.x = mouseX;
  14.     brush.y = mouseY;
  15.     canvas.draw(brush, brush.transform.matrix);
  16.     // draw canvas to itself with offset
  17.     canvas.copyPixels(canvas, canvas.rect, new Point(0,2), null, null, true);
  18.     // draw transparent black overlay
  19.     canvas.copyPixels(overlay, canvas.rect, new Point(0,0), null, null, true);
  20. }

I'm always thinking about good assignments for an experimental visual programming class: "Create an abstract form that resembles a curtain."