forked from: じょじょにブレていく(謎
forked from じょじょにブレていく(謎 (diff: 18)
ActionScript3 source code
/**
* Copyright mesulions ( http://wonderfl.net/user/mesulions )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wkMl
*/
// forked from Saqoosha's じょじょにブレていく(謎
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import funnel.*;
[SWF(width=475, height=475, backgroundColor=0xffffff, frameRate=300)]
public class ScrollMax extends Sprite {
private var _container:Sprite;
private var _obj:Sprite;
private var _tf:TextField;
private var gio:Gainer;
public function ScrollMax() {
gio = new Gainer();
var smoother:Convolution = new Convolution(Convolution.MOVING_AVERAGE);
var scaler:Scaler = new Scaler(0.36, 0.6, 0, stage.stageWidth, Scaler.LINEAR, true);
var smoother2:Convolution = new Convolution(Convolution.MOVING_AVERAGE);
var scaler2:Scaler = new Scaler(0.36, 0.6, 0, stage.stageHeight, Scaler.LINEAR, true);
//スケーラー、スムーサー
gio.analogInput(1).filters = [smoother, scaler];
gio.analogInput(0).filters = [smoother2, scaler2];
_container = new Sprite();
addChild(_container);
_obj = new Sprite();
_obj.x = 237.5;
_obj.graphics.beginFill(0xff0000);
_obj.graphics.drawCircle(0, 0, 100);
_obj.graphics.endFill();
_container.addChild(_obj);
_tf = new TextField();
_tf.defaultTextFormat = new TextFormat('Verdana', 12, 0x0, true);
_tf.autoSize = TextFieldAutoSize.LEFT;
addChild(_tf);
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}
private function _onEnterFrame(event:Event):void {
//x += ((stage.stageWidth / 2 - gio.analogInput(1).value) * 0.1 - sx) * 0.2;
//y += ((stage.stageHeight / 2 - gio.analogInput(0).value) * 0.1 - sy) * 0.2;
_container.y -= Math.random() * 123456;
_obj.y = -_container.y + 237.5;
_tf.text = _obj.y.toString();
}
}
}
