一种颜色
ScriptManager.clearEl();$.root.addEventListener('added', function(e) {e.target.textColor = 0x00FF00;});
load("libBitmap",function(){});
var radius = 15;
var margin = radius + 2;
var particle = $.createCanvas({lifeTime:0});
particle.graphics.lineStyle(2, 16777215);
particle.graphics.beginFill(16777215, 0.5);
particle.graphics.drawEllipse(-radius, -radius, 2 * radius, 2 * radius);
particle.graphics.endFill();
particle.x = 50;
particle.y = 40;
display = $.createCanvas({lifeTime:0});
display.addChild(particle);
var velX = 1;
var velY = 1.3;
var randomAccel = 0.3;
var maxVelX = 6;
var maxVelY = 6;
var bitmapData = Bitmap.createBitmapData($.width, $.height, true, 0);
bitmap = Bitmap.createBitmap({bitmapData:bitmapData});
var _loc_1 = $.createShape({lifeTime:0});
_loc_1.graphics.lineStyle(1, 3355443);
_loc_1.graphics.drawRect(-0.5, -0.5, ($.width + 1), ($.height + 1));
var blur = $.createBlurFilter(4, 4);
colorTransform1 = $.createColorTransform(0.999, 0.95, 0.9, 1);
origin = $.createPoint(0, 0);
colorTransform2 = $.createColorTransform(0.999, 0.95, 0.9, 0.999);
var _loc_2 = 0;
_loc_1.x = 0;
bitmap.x = _loc_2;
var _loc_2 = 0;
_loc_1.y = 0;
bitmap.y = _loc_2;
function onEnter()
{
velX = velX + randomAccel * (2 * Math.random() - 1);
velY = velY + randomAccel * (2 * Math.random() - 1);
if (velX > maxVelX)
{
velX = maxVelX;
}
else if (velX < -maxVelX)
{
velX = -maxVelX;
}
if (velY > maxVelY)
{
velY = maxVelY;
}
else if (velY < -maxVelY)
{
velY = -maxVelY;
}
particle.x = particle.x + velX;
if (particle.x < margin)
{
particle.x = margin;
velX = velX * -1;
}
else if (particle.x > $.width - margin)
{
particle.x = $.width - margin;
velX = velX * -1;
}
particle.y = particle.y + velY;
if (particle.y < margin)
{
particle.y = margin;
velY = velY * -1;
}
else if (particle.y > $.height - margin)
{
particle.y = $.height - margin;
velY = velY * -1;
}
bitmapData.applyFilter(bitmapData, bitmapData.rect, origin, blur);
bitmapData.colorTransform(bitmapData.rect, colorTransform1);
bitmapData.draw(display);
return;
}// end function
$.root.addEventListener('added', function(e) {e.target.textColor = 0x00FF00;});
$.root.addEventListener("enterFrame", onEnter);