Section 1
//MainTimeline (ripples_fla.MainTimeline)
package ripples_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var version;
public var my_menu:ContextMenu;
public var bar;
public var tempo;
public var othersong;
public var music:Music;
public var soundChannel:SoundChannel;
public var mspb;
public var previousEnv;
public var pixels:Array;
public var thissong;
public var centerX;
public var circles:Array;
public var centerY;
public var pixelAnchor:Sprite;
public var credit;
public var maxradius;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function openSClink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("https://soundcloud.com/9c5"));
}
public function populatePixels(){
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < 80) {
pixels.push(new Array());
_local2 = 0;
while (_local2 < 45) {
pixels[_local1].push(new Sprite());
pixels[_local1][_local2].x = (_local1 * 8);
pixels[_local1][_local2].y = (_local2 * 8);
pixels[_local1][_local2].graphics.beginFill(0xFFFFFF);
pixels[_local1][_local2].graphics.drawRect(0, 0, 8, 8);
pixels[_local1][_local2].graphics.endFill();
pixelAnchor.addChild(pixels[_local1][_local2]);
pixels[_local1][_local2].alpha = 0;
_local2++;
};
_local1++;
};
}
public function circlesExpand(){
var _local1:*;
_local1 = 0;
while (_local1 < circles.length) {
var _local2 = circles;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local1++;
};
circles = circles.filter(crop);
}
function frame1(){
stage.align = StageAlign.TOP_LEFT;
my_menu = new ContextMenu();
my_menu.hideBuiltInItems();
version = new ContextMenuItem("Pixel Ripples rev.1");
version.enabled = false;
credit = new ContextMenuItem("Rubber NAND !0x524E/n3E 2015");
credit.enabled = false;
thissong = new ContextMenuItem("Soundcloud");
thissong.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openSClink);
thissong.separatorBefore = true;
othersong = new ContextMenuItem("Bandcamp");
othersong.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openBClink);
my_menu.customItems.push(version, credit, thissong, othersong);
contextMenu = my_menu;
music = new Music();
soundChannel = new SoundChannel();
soundChannel = music.play(0, int.MAX_VALUE);
tempo = 83;
mspb = ((1000 * 60) / tempo);
bar = (mspb * 4);
previousEnv = 0;
pixels = new Array();
pixelAnchor = new Sprite();
stage.addChild(pixelAnchor);
populatePixels();
maxradius = 100;
centerX = 35;
centerY = 25;
circles = new Array();
circles.push(0);
drawCircles();
}
function frame3(){
update();
gotoAndPlay(2);
}
function frame2(){
update();
}
public function crop(_arg1, _arg2:int, _arg3:Array):Boolean{
return ((_arg1 < 100));
}
public function openBClink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("https://jamesjerram.bandcamp.com/"));
}
public function update(){
var _local1:*;
var _local2:Boolean;
pixelDecay();
_local1 = env();
_local2 = (_local1 < previousEnv);
previousEnv = _local1;
circlesExpand();
if (_local2){
circles.push(0);
};
drawCircles();
}
public function drawCircles(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = 0;
while (_local2 < 80) {
_local3 = 0;
while (_local3 < 45) {
_local1 = Math.round(Math.sqrt((Math.pow((_local2 - centerX), 2) + Math.pow((_local3 - centerY), 2))));
_local4 = 0;
while (_local4 < circles.length) {
if (circles[_local4] == _local1){
pixels[_local2][_local3].alpha = 1;
break;
};
_local4++;
};
_local3++;
};
_local2++;
};
}
public function pixelDecay(){
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < 80) {
_local2 = 0;
while (_local2 < 45) {
pixels[_local1][_local2].alpha = (pixels[_local1][_local2].alpha * 0.9);
_local2++;
};
_local1++;
};
}
public function env():Number{
return ((((soundChannel.position % music.length) % bar) / bar));
}
}
}//package ripples_fla
Section 2
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package