forked from: ざわ・・・ ざわ・・・
ここ参考にしてカメラと組み合わせてみたけどうまくいってるのこれ(^^;
* http://wonderfl.kayac.com/code/add20e38c0686a2e95ccd1c172723d5babbde570
* blog@http://tirirenge.undo.jp/?p=1821
/**
* Copyright ahchang ( http://wonderfl.net/user/ahchang )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/lHv8
*/
// forked from chabudai's ざわ・・・ ざわ・・・
// forked from chabudai's ざわ・・・
/**
* ここ参考にしてカメラと組み合わせてみたけどうまくいってるのこれ(^^;
* http://wonderfl.kayac.com/code/add20e38c0686a2e95ccd1c172723d5babbde570
* blog@http://tirirenge.undo.jp/?p=1821
**/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent
import flash.utils.Timer;
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();
import flash.media.Camera;
import flash.media.Video;
[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="60")]
public class ZawaZawa extends Sprite
{
private var _view :Sprite;
private var _cam:Camera;
private var _video:Video;
public function ZawaZawa()
{
var zawaTimer:Timer = new Timer(200);
zawaTimer.addEventListener(TimerEvent.TIMER, addZawa);
zawaTimer.start();
initCamera();
}
private function addZawa(e:TimerEvent):void
{
//少しだけランダムに
var random:uint = Math.random() * 3;
if (random != 1) {
var zawa:Zawa = new Zawa(0x666666);
zawa.x = Math.random() * stage.stageWidth;
zawa.y = Math.random() * stage.stageHeight
var scale:uint = Math.random() * 5;
zawa.scaleX = zawa.scaleY = scale / 10 + 0.6;
addChild(zawa);
Tweener.addTween(zawa, { _tintBrightness:-1, time:2, transition:"easeInSine", delay: 0, onComplete:removeZawa, onCompleteParams:[zawa] } );
zawa.addEventListener(Event.ENTER_FRAME, scaleOut);}
}
private function removeZawa(mc:Sprite):void
{
mc.removeEventListener(Event.ENTER_FRAME, scaleOut);
removeChild(mc);
}
private function scaleOut(e:Event):void
{
e.target.scaleX -= 0.003;
e.target.scaleY -= 0.003;
}
private function initCamera():void {
_view = new Sprite();
this.addChild( _view );
_cam = Camera.getCamera();
_cam.setMode( 500, 500, 15 );
_video = new Video( 500 , 500 );
_video.attachCamera( _cam );
_view.addChild( _video );
}
}
}
import flash.display.Sprite;
class Zawa extends Sprite {
private var color:uint;
private var thickness:uint;
public function Zawa(c:uint=0x000000) {
draw(c);
}
private function draw(c:uint=0x000000):void {
color = c;
thickness = 7;
var sp:Sprite = new Sprite();
addChild(sp);
//ざ
sp.graphics.lineStyle(thickness, color);
sp.graphics.moveTo(-48, -9);
sp.graphics.lineTo( -6, -9);
sp.graphics.moveTo( -33, -19);
sp.graphics.lineTo( -6, 9);
sp.graphics.lineTo( -38, 9);
sp.graphics.curveTo( -49, 9, -49, 18);
sp.graphics.curveTo( -49, 27, -38, 27);
sp.graphics.lineTo( -7, 27);
sp.graphics.moveTo( -17, -26);
sp.graphics.lineTo( -17, -18);
sp.graphics.moveTo( -7, -26);
sp.graphics.lineTo( -7, -18);
//わ
sp.graphics.moveTo(15, -16);
sp.graphics.lineTo(15, 27);
sp.graphics.moveTo(5, -10);
sp.graphics.lineTo(27, -10);
sp.graphics.lineTo(6, 26);
sp.graphics.moveTo(18, 5);
sp.graphics.curveTo(28, -6, 42, 0);
sp.graphics.curveTo(50, 5, 49, 14);
sp.graphics.curveTo(48, 23, 36, 27);
//・・・
sp.graphics.lineStyle();
sp.graphics.moveTo(62, 10);
sp.graphics.beginFill(color);
sp.graphics.drawCircle(64, 11, 4.5);
sp.graphics.drawCircle(79, 11, 4.5);
sp.graphics.drawCircle(94, 11, 4.5);
sp.graphics.endFill();
}
}