Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

Follow Me

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


Image effect using fillRect

3. A little modification.. another effect type

Now, modifying a little the above code you can do another kind of effect like this (granular):

 

and this is the fill() method modified:

function fill(){
	for(row = 0; row < h; row += pixelSize){
		for(col = 0; col < w; col += pixelSize){
			rect.width  = pixelSize*2
			rect.height = pixelSize*2
			rect.y = (row) - pixelSize
			rect.x = (col) - pixelSize
			img.fillRect(rect, cloned.getPixel32(col, row))
		}
	}
	pixelSize -= 1
	if(pixelSize < 2){
		img = BitmapData.loadBitmap('image');
		mc.attachBitmap(img,1);
		delete this.onEnterFrame
	}
}

 

6. Download file source

Download files used in this tutorial