BitmapDataのscroll()を使ってみた
/**
* Copyright gaziya ( http://wonderfl.net/user/gaziya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/yFag
*/
package {
import flash.geom.Matrix;
import flash.geom.ColorTransform;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Shape;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
graphics.beginFill(0xffcc00)
graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight)
var bitmapData:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0x0)
addChild(new Bitmap(bitmapData))
var shape:Shape = new Shape
shape.graphics.beginFill(0xff0000)
shape.graphics.drawCircle(0,0,10)
var theta:Number = 0
addEventListener(Event.ENTER_FRAME, function(e:Event):void {
bitmapData.colorTransform(bitmapData.rect, new ColorTransform(1,1,1,0.99))
var matrix:Matrix = new Matrix
matrix.translate(stage.stageWidth*2/3,stage.stageHeight/2)
matrix.translate(0,100*Math.sin(theta))
bitmapData.scroll(-2,0)
bitmapData.draw(shape,matrix)
theta -= 0.02*Math.PI
theta %= 2*Math.PI
})
}
}
}