In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Cubo gira

/**
 * Copyright vlad.el.rojo ( http://wonderfl.net/user/vlad.el.rojo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6th5
 */

// forked from DaniilTutubalin's flash on 2011-10-19
package {
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
[SWF(width=440, height=440, backgroundColor=0x404080, frameRate=30)]
public class FlashTest extends Sprite {
public function FlashTest() {
 /**
 * 25-Line ActionScript Contest Entry
 * 
 * Project: The Holictic Cube Of Life, The Universe, Self, And Everything
 * Author: Daniil Tutubalin, Tomsk, Russia
 * Email: tutubalin@gmail.com
 * Date: 11/25/2008
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
 
// 3 free lines! Alter the parameters of the following lines or remove them.
// Do not substitute other code for the three lines in this section

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

/* 1 */var data:Array = [{x:-100,y:-100,z:-100},{x:-100,y:100,z:-100,rotationX:90},{x:-100, y:-100, z:100, rotationY:90},{x:100, y:-100, z:100, rotationY:180},{x:-100, y:-100, z:100, rotationX:-90},{x:100, y:-100, z:-100, rotationY:-90}];
/* 2 */addChild(new Sprite()).x = getChildAt(0).y = 300;
/* 3 */var cube:* = getChildAt(0)["addChild"](new Sprite());
/* 4 */for (var i:int=0; i<6; i++) {   
/* 5 */    cube.addChild(new Sprite()).addChild((new Bitmap(i==1?new BitmapData(100,100,false,0):new BitmapData(200,200,false,0))));
/* 6 */    for (var s:String in data[i]) cube.getChildAt(i)[s] = data[i][s];
       }
/* 7 */cube.getChildAt(4)["addChild"](new Video(200,200)).attachCamera(Camera.getCamera());    
/* 8 */cube.getChildAt(1).getChildAt(0).scaleX = cube.getChildAt(1).getChildAt(0).scaleY = 2;
/* 9 */stage.addEventListener(Event.ENTER_FRAME, function(e:Event):void {                                                                                      
/*10 */    cube.getChildAt(3).getChildAt(0).bitmapData.copyPixels(cube.getChildAt(0).getChildAt(0).bitmapData, cube.getChildAt(3).getChildAt(0).bitmapData.rect, new Point());                                              
/*11 */    cube.rotationY = 220-mouseY-mouseX-i+(cube.rotationX=mouseY-220);
/*12 */    getChildAt(0).rotationY = getChildAt(0).x = getChildAt(0).y = 0;    
/*13 */    for (var j:int=0; j<6; j++) cube.getChildAt(j).visible = (cube.getChildAt(j).local3DToGlobal(new Vector3D()).x-cube.getChildAt(j).local3DToGlobal(new Vector3D(100)).x)*(cube.getChildAt(j).local3DToGlobal(new Vector3D()).y-cube.getChildAt(j).local3DToGlobal(new Vector3D(0,100)).y)>(cube.getChildAt(j).local3DToGlobal(new Vector3D()).y-cube.getChildAt(j).local3DToGlobal(new Vector3D(100)).y)*(cube.getChildAt(j).local3DToGlobal(new Vector3D()).x-cube.getChildAt(j).local3DToGlobal(new Vector3D(0,100)).x);
/*14 */    getChildAt(0).rotationY = i+(getChildAt(0).x = getChildAt(0).y = 220);
/*15 */    cube.getChildAt(0).getChildAt(0).bitmapData.perlinNoise(200,200,2,0,false,false,7,false);
/*16 */    cube.getChildAt(0).getChildAt(0).bitmapData.draw(getChildAt(0), new Matrix(0.3,0,0,0.3,100,100));   
/*17 */    for (j=0; j<6; j++) cube.getChildAt(j).visible = (cube.getChildAt(j).local3DToGlobal(new Vector3D()).x-cube.getChildAt(j).local3DToGlobal(new Vector3D(100)).x)*(cube.getChildAt(j).local3DToGlobal(new Vector3D()).y-cube.getChildAt(j).local3DToGlobal(new Vector3D(0,100)).y)>(cube.getChildAt(j).local3DToGlobal(new Vector3D()).y-cube.getChildAt(j).local3DToGlobal(new Vector3D(100)).y)*(cube.getChildAt(j).local3DToGlobal(new Vector3D()).x-cube.getChildAt(j).local3DToGlobal(new Vector3D(0,100)).x);
/*18 */    if (i%1000 == 6) cube.getChildAt(1).getChildAt(0).bitmapData.noise(int(Math.random()*int.MAX_VALUE),0,8,7,true);
/*19 */    else cube.getChildAt(1).getChildAt(0).bitmapData.applyFilter(cube.getChildAt(1)["getChildAt"](0).bitmapData, new Rectangle(0,0,100,100), new Point(), new ConvolutionFilter(3, 3, [3,3,3,3,2,3,3,3,3],255,0,true,false,0,1));
/*20 */    cube.getChildAt(1).getChildAt(0).bitmapData.threshold(cube.getChildAt(1)["getChildAt"](0).bitmapData, new Rectangle(0,0,100,100), new Point(), "==",8, 0xFFFFFFFF, 0xFC);
/*21 */    cube.getChildAt(1).getChildAt(0).bitmapData.threshold(cube.getChildAt(1)["getChildAt"](0).bitmapData, new Rectangle(0,0,100,100), new Point(), "!=",0xFFFFFFFF, 0);
/*22 */    cube.getChildAt(2).getChildAt(0).bitmapData.perlinNoise(100,100,3,0,false,false,7,false,[new Point(i++,0),new Point(i*2,0),new Point(i*3,0)]);  
/*23 */    cube.getChildAt(5).getChildAt(0).bitmapData.fillRect(new Rectangle(Math.sin(i/70)*100+100,Math.cos(i/50)*100+100,3,3),(int(Math.sin(i/87)*128)<<16)+(int(Math.sin(i/100+Math.PI*2/3)*128)<<8)+(int(Math.sin(i/130+Math.PI*4/3)*128))+0x808080);
/*24 */    cube.getChildAt(5).getChildAt(0).bitmapData.draw(cube.getChildAt(5).getChildAt(0).bitmapData,new Matrix(0.9751040819724653,0.0978367483138916,-0.0978367483138916,0.9751040819724653,12.27326663414263,-7.294083028635697),null,"lighten",null,true);
/*25 */    cube.getChildAt(5).getChildAt(0).bitmapData.applyFilter(cube.getChildAt(5).getChildAt(0).bitmapData,new Rectangle(0,0,200,200),new Point(),new BlurFilter(2,2));    
});            
}
}
}