Flash + Painting = Flainting
by Thai on September 30, 2009
[swfobj src="http://www.bionicworks.com/wp-content/uploads/2009/09/painting1.swf" align="center" allowfullscreen="false"]
This is my attempt to create ActionScript 3 generated paintings again. I like to think that these are digital paintings because it’s a bit abstract and you’re using design elements from painting. Well, it’s a little interactive too. You can hover over the instances of Kirby and he’ll pop out. Doing these will give me the chance to pick apart the neat things you can do with AS 3. The class is really simple and if you want, you can mess with it.
package
{
//import all the goodies to play with
import flash.display.MovieClip;
import flash.filters.BitmapFilterQuality;
import flash.filters.BlurFilter;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
//create blur filter
var blur:BlurFilter = new BlurFilter();
public function Main()
{
init();
}
public function init()
{
for(var i:int=0; i < 300; i++)
{
//create an instance of a movieclip from the library
var clip:Circle = new Circle();
//generate x and y coordinates
var xpos:uint = 550*Math.cos(i);
var ypos:uint = 400*Math.sin(i);
var randomnumber:Number = Math.random()*25;
//use the random number for blur properties
blur.blurX = randomnumber;
blur.blurY = randomnumber;
blur.quality = BitmapFilterQuality.MEDIUM;
clip.x = Math.random()*xpos;
clip.y = Math.random()*ypos;
//remove clip if it’s beyond the borders
if(clip.x < 0 || clip.y < 0){clip.visible = false;}
clip.alpha = .50;
clip.scaleX = clip.scaleY = Math.random()*.5;
clip.filters = [blur];
//add an event listener to the instance
clip.addEventListener(MouseEvent.MOUSE_OVER, onHover, false,0 ,true);
addChild(clip);
}
}
public function onHover(event:MouseEvent)
{
//on mouse over, set the alpha property to 100%
event.target.alpha = 1;
}
}
{
//import all the goodies to play with
import flash.display.MovieClip;
import flash.filters.BitmapFilterQuality;
import flash.filters.BlurFilter;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
//create blur filter
var blur:BlurFilter = new BlurFilter();
public function Main()
{
init();
}
public function init()
{
for(var i:int=0; i < 300; i++)
{
//create an instance of a movieclip from the library
var clip:Circle = new Circle();
//generate x and y coordinates
var xpos:uint = 550*Math.cos(i);
var ypos:uint = 400*Math.sin(i);
var randomnumber:Number = Math.random()*25;
//use the random number for blur properties
blur.blurX = randomnumber;
blur.blurY = randomnumber;
blur.quality = BitmapFilterQuality.MEDIUM;
clip.x = Math.random()*xpos;
clip.y = Math.random()*ypos;
//remove clip if it’s beyond the borders
if(clip.x < 0 || clip.y < 0){clip.visible = false;}
clip.alpha = .50;
clip.scaleX = clip.scaleY = Math.random()*.5;
clip.filters = [blur];
//add an event listener to the instance
clip.addEventListener(MouseEvent.MOUSE_OVER, onHover, false,0 ,true);
addChild(clip);
}
}
public function onHover(event:MouseEvent)
{
//on mouse over, set the alpha property to 100%
event.target.alpha = 1;
}
}
Leave your comment