ff: HTML5 logo

by matacat forked from HTML5 logo (diff: 37)
♥0 | Line 78 | Modified 2011-01-20 20:45:01 | MIT License
play

ActionScript3 source code

/**
 * Copyright matacat ( http://wonderfl.net/user/matacat )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/nfgD
 */

// forked from 9re's HTML5 logo
package {
    import flash.net.URLRequest;
    import flash.net.navigateToURL;
    import flash.display.Sprite;
    import frocessing.color.ColorHSL;
    import frocessing.shape.FShapeSVG;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            with(addChild(new FShapeSVG(<g> 
        <g> 
            <!-- FShapeSVG does not support hsl() -->
            <!-- If you would like to customize the color of the badge, these two HSL colors are the primary oranges --> 
            <!--  The second one needs to be +6 hue, +9% saturation, and +3% lightness of the first --> 
            <polygon fill={hsl(13, 77, 52)} points="107.644,470.877 74.633,100.62 437.367,100.62 404.321,470.819 255.778,512             "/> 
            <polygon fill={hsl(18, 86, 55)} points="256,480.523 376.03,447.246 404.27,130.894 256,130.894             "/> 
            <g> 
                <polygon fill="#EBEBEB" points="256,268.217 195.91,268.217 191.76,221.716 256,221.716 256,176.305 255.843,176.305 142.132,176.305 143.219,188.488 154.38,313.627 256,313.627                 "/> 
                <polygon fill="#EBEBEB" points="256,386.153 255.801,386.206 205.227,372.55 201.994,336.333 177.419,336.333 156.409,336.333 162.771,407.634 255.791,433.457 256,433.399                 "/> 
            </g> 
            <g> 
                <path d="M108.382,0h23.077v22.8h21.11V0h23.078v69.044H152.57v-23.12h-21.11v23.12h-23.077V0z"/> 
                <path d="M205.994,22.896h-20.316V0h63.72v22.896h-20.325v46.148h-23.078V22.896z"/> 
                <path d="M259.511,0h24.063l14.802,24.26L313.163,0h24.072v69.044h-22.982V34.822l-15.877,24.549h-0.397l-15.888-24.549v34.222h-22.58V0z"/> 
                <path d="M348.72,0h23.084v46.222h32.453v22.822H348.72V0z"/> 
            </g> 
            <g> 
                <polygon fill="#FFFFFF" points="255.843,268.217 255.843,313.627 311.761,313.627 306.49,372.521 255.843,386.191 255.843,433.435 348.937,407.634 349.62,399.962 360.291,280.411 361.399,268.217 349.162,268.217                 "/> 
                <polygon fill="#FFFFFF" points="255.843,176.305 255.843,204.509 255.843,221.605 255.843,221.716 365.385,221.716 365.385,221.716 365.531,221.716 366.442,211.509 368.511,188.488 369.597,176.305                 "/> 
            </g> 
        </g> 
    </g>).toSprite())) {
                scaleX = scaleY = 0.8;
                x = 30;
                y = (465 - height) >> 1;
                buttonMode = true;
                addEventListener("click", function ():void {
                    navigateToURL(new URLRequest('http://www.w3.org/html/logo/'), '_blank');
                });
            }
            
            function hsl(h:int, s:int, l:int):String {
                return "#" + new ColorHSL(h, s/100, l/100).value.toString(16);
            }
            
            graphics.beginFill(0xF2F2F2);
            graphics.drawRect(0, 0, 465, 465);
            
            var s:S = addChildAt(new S(null), 0) as S;
            for (var i:int = 1; i < 32; i++) s = addChildAt(new S(s), 0) as S;
            var head:S = s;
            
            addEventListener("enterFrame", function():void {
                s = head;
                do { s.update(); } while (s = s.next);
            });
        }
    }
}
import flash.display.Shape;
import flash.geom.Vector3D;
class S extends Shape {
    private static const P:Number = Math.PI / 180;
    private static var rz:Number = 360 / 64;
    public var next:S;
    public function S(next:S) {
        this.next = next;
        z = 0;
        graphics.lineStyle(20, 0xFFFFFF);
        graphics.lineTo(700, 0);
        transform.matrix3D.appendRotation(-30, Vector3D.Y_AXIS);
        transform.matrix3D.appendRotation(rz, Vector3D.Z_AXIS);
        transform.matrix3D.appendTranslation(232.5, 232.5, 0);
        rz += 360 / 32;
    }
    public function update():void
    {
        var v:Vector.<Vector3D> = transform.matrix3D.decompose();
        v[1].x += P * 5;
        v[1].z += P / 2;
        transform.matrix3D.recompose(v);
    }
}