symmetrical camera
サムネで遊びたかっただけです
/**
* Copyright hig_an ( http://wonderfl.net/user/hig_an )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/m56U
*/
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.media.Camera;
import flash.media.Video;
import flash.display.Sprite;
[SWF(backgroundColor = '#000000', frameRate = '30', width = '465', height = '465')];
public class Main extends Sprite {
private var _cam:Camera;
private var _vid:Video;
private var _bmp:Bitmap;
private var _bmpd:BitmapData;
private var _bmpRev:Bitmap;
private var _bmpdRev:BitmapData;
private var cameraWidth:Number;
private var cameraHeight:Number;
private var screen:BitmapData;
public function Main() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
cameraWidth = stage.stageWidth;
cameraHeight = stage.stageHeight-30;
_cam = Camera.getCamera();
_cam.setMode(cameraWidth, cameraHeight, 15);
_vid = new Video(cameraWidth, cameraHeight);
_vid.attachCamera(_cam);
_bmpd = new BitmapData(cameraWidth/2, cameraHeight, false);
screen = new BitmapData(cameraWidth, cameraHeight, false);
addChild( new Bitmap(screen));
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void {
_bmpd.draw(_vid);
var matrix:Matrix = new Matrix( -1, 0, 0, 1, _bmpd.width, 0);
screen.copyPixels(_bmpd, _bmpd.rect, new Point());
_bmpd.draw(_vid, matrix);
screen.copyPixels(_bmpd, _bmpd.rect, new Point(cameraWidth / 2, 0));
}
}
}