Archive for the 'as3' Category

MinimalDesigner – Layout tool for Bit101’s MinimalComps

Keith has released a layout tool for the excellent MinimalComps.

MinimalDesigner

I prefer to write pure AS3 inFlashDevelop, using the Flex SDK to compile. I’ve used MinimalComps on occasion, and I’ve been happy with the results. However when it comes to laying out anything particularly complex, I’ve had to fall back to Flex or CS3.

The release of MinimalDesigner should make using MinimalComps even easier now. Thanks Keith!

Bookmark and Share

AS3 BitmapData.hitTest() with rotation

I saw a tweet from @mesh today, asking about hitTest when one object is rotated. A bit of horrible hackery, and here’s the result. Warning, nasty thrown-together code! ;)

var red:Sprite = new Sprite();
red.graphics.beginFill(0xFF0000);
red.graphics.lineTo(40, 0);
red.graphics.lineTo(40, 150);
red.graphics.lineTo(0,150);
red.graphics.lineTo(0,0);

red.x = 40;
red.y = 40;

addChild(red);

var green:Sprite = new Sprite();

green.graphics.beginFill(0x00FF00);
green.graphics.lineTo(40, 0);
green.graphics.lineTo(40, 150);
green.graphics.lineTo(0,150);
green.graphics.lineTo(0,0);

green.x = 300;
green.y = 40;

addChild(green);

var useRotation:Number=10;

var redBmpData = new BitmapData(red.width, red.height, true, 0);
redBmpData.draw(red);

var useDimension:int = Math.ceil(Math.sqrt((green.width * green.width) + (green.height * green.height)));
var diffWidth:int = useDimension - green.width;
var diffHeight:int = useDimension - green.height;
var newBD:BitmapData = new BitmapData(useDimension,useDimension,true,0);
var angle_in_radians:Number = Math.PI * 2 * (useRotation / 360);
var m:Matrix = new Matrix();
m.translate((green.width / 2) * -1, (green.height / 2) * -1);
m.rotate(angle_in_radians);
m.translate(green.width / 2, green.height / 2);
m.translate(diffWidth / 2, diffHeight / 2);
var translatedPoint:Point = m.transformPoint(new Point(0,0));

trace(useDimension);
var greenBmpData = new BitmapData(useDimension,useDimension,true,0);
greenBmpData.draw(green,m);

/*var sampleGreen:Bitmap =new Bitmap(greenBmpData);
addChild(sampleGreen);
sampleGreen.x=200;
sampleGreen.y=200;
*/
green.rotation=useRotation;

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

function onMouseMove(e:MouseEvent):void {
	green.x = mouseX;
	green.y = mouseY;

	if (redBmpData.hitTest(new Point(red.x, red.y),
	255,
	greenBmpData,
	new Point(green.x-translatedPoint.x, green.y-translatedPoint.y),
	255

	  )) {
		trace("hit");
		red.filters = [new GlowFilter()];
	} else {
		red.filters = [];
	}
}

I’ll blog a better example of this, with comments and an explanation of what it’s doing in the next few days.

Bookmark and Share

Useful stuff: Papervision GUI, AS3 Code Snippet, UML editor, Firefox Plugin

Here’s a few useful things I’ve seen recently. Thought I’d share..

VizualPV3D

A GUI for Papervision! It looks rather similar to Lightwave, although orders of magnitude less powerful. I’ll be interested to see how this evolves. Could come in handy one day!
http://www.juxtinteractive.com/work/vizualpv3d/

Swf Class Explorer

This was a useful utility on a recent project, as there’s no “ApplicationDomain.getAllDefinitions():Array”. Worth bookmarking.
http://flassari.is/2008/07/swf-class-explorer-for-as3/

Violet UML Editor

Jon from Unwrong showed me this rather nifty UML editor. Great for drawing quick, simple diagrams. Cross-platform, and free.
http://alexdp.free.fr/violetumleditor/page.php

Talon: Firefox Plugin

A great plugin for Firefox, which allows you to right-click and capture a page (or region). From there you can upload/share/edit on Aviary, copy to clipboard, or save to desktop.
http://www.readwriteweb.com/archives/aviarys_talon_a_drool-worthy_firefox_plug-in_for_e.php

Bookmark and Share

Fluid Dynamics in Flash

This is one of the most entrancing Flash experiments I’ve ever seen. Eugine Zatepyakin, a Flash Developer in Moscow, has created a rather stunning fluid simulation in AS3.  It’s a fantastic toy, and really quite inspiring. I must take a look through the code when I get some time.

Fluid dynamics

Simply stunning.

It’s based on work by Mehmet Akten, which in turn is based on this paper: Real-Time Fluid Dynamics for Games.

Bookmark and Share

Bow Street Runner up for another award

bsr

It just doesn’t stop. The multiple-award-winning Bow Street Runner we made for Channel 4 is up for another award, this time it’s the Broadcast Digital Awards. We’re in the Best Use of Digital Technology category.

The nominees are:

  • BBC iPlayer
  • Bow Street Runner, Channel4.com
  • Current
  • Freesat
  • Mycbbc
  • Obama: The Inauguration, Sky News

Wow. That’s quite some company to have!

Bookmark and Share

Generative art application – project screenshots

Since being inspired by Matt’s generative art session at Flashbrighton a while back,  I’ve been occasionally working on a personal project. It’s a Flex application where you can generate interesting abstract images and animations. It’s tricky to describe exactly what it is and what it does, so you can see for yourselves when I release it.

It was initially a simple idea of mine to see what something looked like when manipulated in a certain way. After playing around with it for a while and adding more functionality, I began finding myself entranced by the things I/it was accidentally creating. When I’ve added a bit more functionality I’ll release it and see if anyone else finds it as intriguing as I do :)

If you’re interested in helping me alpha-test this, then let me know.

[Edit: By the way, it's using Papervision]

Here’s some screenshots:

Red
red

 

Lines
lines 

 

Rainbow
rainbow

 

Distribution
distribution 

 

Browns
browns 

Bookmark and Share

Wallace and Gromit at the Science Museum

I’ve been working on a game for the Wallace and Gromit installation at the Science Museum.

Here’s a photo I took a while back:
My 1337 arcade controller

It was a brilliant project to work on, and one of the most fun things I’ve done for a while. Everyone involved was fantastic, and the exhibition itself looks superb. The game is now installed on a row of consoles and is open to the public. The controls are made from arcade-quality components, and uses a Mini-Pac to talk to the PC via USB.

Here’s a very brief clip of it on BBC News 24 (00:30):

If you’re in the area, do go and check out the exhibition, it’s great!

Bookmark and Share

Papervision experiment #3: 3D colour cube v2

A combination of the last two posts, with a few extra tweaks. This time it produces quite a pleasing blur if you click and hold down.

cube_blur

Bookmark and Share

Papervision experiment #2: 3D colour cube

Here’s another experiment along the same lines as the last one, with the same mouse controls. 

This time it’s 15,625 Pixel3D points, and the position in the cube defines the colour. 

I really like the moirre effect.

cube_1

Bookmark and Share

Papervision Experiment #1: Fire sphere

Recently I’ve been inspired to create some experimental things in Papervision. I think that it’s mainly down to Matt’s talk on generative art at FlashBrighton a few weeks back. 

Well, here’s the first.  in brief:

- Plot 9902 Pixel3D points evenly around the surface of a sphere
- Colour each one a random red
- Rotate the sphere depending on where the mouse is
- Apply a blur effect to a BitmapEffectLayer
- Change the clippingPoint 

I kinda liked the effect, so here we go. Hold the mouse down to push the sphere away.

Fire Sphere

Bookmark and Share