Estrellas Brillantes ... @author Obed Santos debosotnas forked:0favorite:8lines:105license : All rights reserved modified : 2009-04-20 09:39:08 Embed Tweet package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.display.MovieClip; import flash.events.Event; import flash.geom.ColorTransform; import flash.geom.Matrix; import flash.geom.Rectangle; import flash.utils.Dictionary; import flash.display.PixelSnapping; import net.hires.debug.Stats; /** * ... * @author Obed Santos */ public class main extends MovieClip{ public const MAXIMA_CANT_PIXELS:uint = 450; public var bmpD:BitmapData; public var bmp:Bitmap; public var matricita:Matrix; public var listapixelitos:Dictionary; private var cantidad_actual_pix:uint = 0; public var ancho_total:uint; public var alto_total:uint; private var color_fondo_total:uint = 0x000000; public var bmpD2:BitmapData; public var bmpSegundo:Bitmap; public var bmpD3:BitmapData; private var bmpTercero:Bitmap; private var matricita_tres:Matrix; public function main() { ancho_total = stage.stageWidth; alto_total = stage.stageHeight; bmpD = new BitmapData(ancho_total, alto_total, false, color_fondo_total); bmp = new Bitmap(bmpD); addChild(bmp); bmpD2 = new BitmapData(ancho_total / 4, alto_total / 4, false, color_fondo_total); bmpSegundo = new Bitmap(bmpD2, PixelSnapping.NEVER, true); bmpSegundo.scaleX = bmpSegundo.scaleY = 4; bmpSegundo.blendMode = BlendMode.ADD; matricita = new Matrix(.25, 0, 0, .25); addChild(bmpSegundo); bmpD3 = new BitmapData(ancho_total / 8, alto_total / 8, false, color_fondo_total); //bmpD3.colorTransform(bmpD3.rect, new ColorTransform(1,1,1,1,140)); bmpTercero = new Bitmap(bmpD3, PixelSnapping.NEVER, true); bmpTercero.scaleX = bmpTercero.scaleY = 8; bmpTercero.blendMode = BlendMode.ADD; matricita_tres = new Matrix(.125, 0, 0, .125); //var ann:Number = 40 * Math.PI / 180; //matricita_tres.concat(new Matrix(Math.cos(ann), Math.sin(ann), -Math.sin(ann), Math.cos(ann))); addChild(bmpTercero); listapixelitos = new Dictionary(); addEventListener(Event.ENTER_FRAME, on_enter_frame); addChild(new Stats()); } private function on_enter_frame(e:Event):void { bmpD.lock(); render_background(); render_pixelitos(); add_pixelitos(); render_brillo(); bmpD.unlock(); } private function render_brillo():void{ bmpD2.draw(bmpD, matricita); bmpD3.draw(bmpD, matricita_tres); } private function add_pixelitos():void { if (cantidad_actual_pix < MAXIMA_CANT_PIXELS) { //var pixelillo:pixelito = new pixelito(ancho_total/2,alto_total/2, 0xFFFFFFFF); var pixelillo:pixelito = new pixelito(mouseX, mouseY, Math.random() * 0xFFFFFFFF); pixelillo.pintar(bmpD); listapixelitos[pixelillo] = true; cantidad_actual_pix++; } } private function render_pixelitos():void{ for (var k:* in listapixelitos) { var temp_pixelito:pixelito = pixelito(k); temp_pixelito.mover_y_pintar(bmpD); if (temp_pixelito.ypos > alto_total || temp_pixelito.ypos < 0 || temp_pixelito.xpos > ancho_total || temp_pixelito.xpos < 0) { delete listapixelitos[k]; cantidad_actual_pix--; } } } private function render_background():void{ bmpD.fillRect(bmpD.rect, color_fondo_total); } } } import flash.display.BitmapData; class pixelito { public var ypos:Number; public var xpos:Number; public var color:uint; private var direccion:Number; public function pixelito(x:int, y:int, col:uint):void { ypos = y; xpos = x; color = col; direccion = (Math.random() * 360) * Math.PI / 180; } public function mover_y_pintar(_bmp:BitmapData):void { this.xpos += Math.cos(direccion); this.ypos += Math.sin(direccion); pintar(_bmp); } public function pintar(_bmp:BitmapData):void{ _bmp.setPixel(xpos, ypos, color); } } Code Fullscreen Preview Fullscreen FlashFit eternity_hir.. hacker_tmbt9.. TUNCAYS OneInchPunch.. ngtn clockmaker : きれい zahir : モーション bitmap bitmapdata blendmode colortransform matrix モーション Dictionary unlock lock setPixel Stats fillRect BitmapData draw Math.cos Math.PI rect Math.sin Event.ENTER_FRAME uint Math.random Event int Number