“Them bits shall do what I tell them to”

Feb

4

Esoteric framework updates

I've been working on the Esoteric Framework, a tool to quickly develop 2D and 3D Flash apps. A lot has changed since the latest release. Here are some of the new features:

  • Updated for Flash Player 10, supports 3D coordinates for display objects
  • Now uses Away3D 10 lite instead of Papervision3D for advanced 3D functionality
  • New 3D functionality, such as loading scenes in formats supported by Away3D 10 lite
  • Import SWF content so you can design in Flash and program using the framework!
  • Improved scripting language, with support for objects and functions
  • Added the eQuery framework, inspired by jQuery, to make scripting even easier
  • Timeline element to create second based timelines
  • VideoFile element to load external FLVs
  • Cache for external images and files
  • Performance improvements
  • SDK to create custom elements

This thing is definitely not ready for a release yet, but it's a big step forward. Here's a little example that shows some of the new features:

Source code:

<MyApp>
	
	<Scene3D id="scene" rotationX="{-20 + mouseY / 10}">
		<Collada id="collada" url="assets/preloader.dae" rotationY="{mouseX}" />
	</Scene3D>
	
	<Camera3D id="camera" y="-850" z="-2000" rotationX="-20" rotationY="10" />
	
	<BlurFilter id="blur" blurX="100" blurY="{this.blurX}" />
	
	<Sprite filters="{[$('#blur').elements()]}">
		<View3D
			scene="{$('#scene').elements()}"
			camera="{$('#camera').elements()}"
			x="{stageWidth / 2}"
			y="{stageHeight / 2}"
			minX="{-stageWidth / 2}"
			maxX="{stageWidth / 2}"
			minY="{-stageHeight / 2}"
			maxY="{stageHeight / 2}"
		/>
	</Sprite>
	
	<BitmapFile url="assets/fg.png" />
	
	<Script>
		<![CDATA[
			// add a listener when COLLADA is loaded
			$('#collada').complete(function(e) {
				// tween camera
				$('#camera').animate({z: -1200, rotationX: -35, rotationY: 0}, 4);
				// dim blur
				$('#blur').animate('blurX', 1, 4, easing.bounce.easeOut);
			});
		]]>
	</Script>
	
</MyApp>
Loading mentions Retweet

Comments [0]

Feb

1

Perspective projection in Flash 10

Flash 10 added new features to render triangle meshes. However the vertices have to be converted to 2D first since Graphics.drawTriangles() is a 2D function. This can be done by using flash.geom.Utils3D.projectVectors() to project a vector of 3D vertices using a projection matrix. However I noticed that this function does not use standard projection matrix like the ones used by OpenGL or DirectX. For simple projections you can use PerspectiveProjection.toMatrix3D(). However this will create a matrix that disregards the projection center, so it can't create off-center projections. The matrix used by Flash 10 seems pretty powerful, however it is poorly documented, if at all. I was able to figure out how the Flash 10 projection matrix works, and how to use it to create off-center perspective projections. Feel free to use this code if you need an off-center projection matrix that is compatible with flash.geom.Utils3D.projectVectors().



/*
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~                           Esoteric Framework                            ~
    ~                       framework.esotericorp.com                         ~
    ~                                                                         ~
    ~                  Crafted with care by Stephan Florquin                  ~
    ~                       stephan.florquin@gmail.com                        ~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    -----                                                                 -----

    Copyright (c) 2010 Stephan Florquin

    Permission is hereby granted, free of charge, to any person    obtaining a
    copy of this software and associated documentationfiles (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.
    
    -----                                                                 -----
*/

package com.esoteric.utils 
{
    import flash.geom.Matrix3D;
    import flash.geom.PerspectiveProjection;
    
    /**
     * 3D math functions.
     * 
     * @author Stephan Florquin
     */
    public class Math3D
    {
        
        /**
         * Creates a Matrix3D that can be used with
         * flash.utils.Utils3D.projectVectors().
         * 
         * This matrix works diffently than transorm matrices:
         * 
         * sxx        syx        szx        cfx
         * sxy        syy        szy        cfy
         * sxz        syz        szz        cfz
         * dx        dy        dz        cd
         * 
         * The method flash.utils.Utils3D.projectVectors() will use this matrix
         * to compute the screen coordinate of a points P using the matrix in
         * the following way:
         * 
         * X(x,y,z) = (sxx*x + sxy*y + sxz*z + dx)/(cfx*x + cfy*y + cfz*z + cd)
         * Y(x,y,z) = (syx*x + syy*y + syz*z + dy)/(cfx*x + cfy*y + cfz*z + cd)
         * Z(x,y,z) = (szx*x + szy*y + szz*z + dz)/(cfx*x + cfy*y + cfz*z + cd)
         * 
         * See AyMaN comment on this page:
         * 
         * http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/geom/
         * PerspectiveProjection.html
         * 
         * @param    fov                    the field of view
         * @param    cx                    projection center x
         * @param    cy                    projection center y
         * @param    pixelPerUnitRatio    the pixel per unit ratio
         */
        public static function perspectiveMatrix3D(
            fov:Number,
            cx:Number = 0, cy:Number = 0,
            pixelPerUnitRatio:Number = 250
        ):Matrix3D 
        {
            var sxx:Number = pixelPerUnitRatio / Math.tan(fov * Math.PI / 360);
            var syy:Number = sxx;
            var dx:Number  = -cx * sxx;
            var dy:Number  = -cy * syy;
            
            var m:Vector.<Number> = new Vector.<Number>();
            
            m.push(    sxx,    0,        0,        0    );
            m.push(    0,        syy,    0,        0    );
            m.push(    cx,        cy,        1,        1    );
            m.push(    dx,        dy,        0,        1    );
            
            return new Matrix3D(m);
        }
        
        /**
         * Converts a perspective projection to a pespective matrix, taking
         * into account the projection center.
         * 
         * @param    pp                    the perspective projection
         * @param    pixelPerUnitRatio    the pixel per unit ratio
         * @return    the perspective matrix
         */
        public static function ppToMatrix3D(
            pp:PerspectiveProjection,
            pixelPerUnitRatio:Number = 250
        ):Matrix3D
        {
            var fov:Number = pp.fieldOfView;
            var cx:Number = pp.projectionCenter.x;
            var cy:Number = pp.projectionCenter.y;
            
            return perspectiveMatrix3D(fov, cx, cy, pixelPerUnitRatio);
        }
        
        /**
         * Converts a field of view to a focal length.
         * @param    fov    the field of view
         * @return    the focal length
         */
        public static function focalLengthFromFoV(fov:Number):Number
        {
            return -.5 * Math.cos(fov * .5) / Math.sin(fov * .5);
        }
        
    }

}


Loading mentions Retweet

Comments [0]

Dec

4

Designing a desktop music app using the 8tracks API and the Esoteric framework

Loading mentions Retweet

Comments [1]

Aug

10

Esoteric Framework 0.3.0 released

I just pushed version 0.3.0 of the Esoteric Framework. It adds while loops, if statements, and new methods to manipulate elements dynamically.

Here are the release notes:

===============================================================================
= E S O T E R I C F R A M E W O R K v 0 . 0 . 3 R E L E A S E N O T E S =
===============================================================================

__ New in this release ________________________________________________________

* Upgraded to latest version OF ANTLR and regenerated scanners and parser.
* Upgraded to latest version of PV3D (no longer GreatWhite branch).
* Implemented if statements in scripts.
* Implemented while loops in scripts.
* Added createElement() to application element.
* Added removeChild() and destroy() to elements.

__ Planned features for 0.0.4 _________________________________________________

The next release will focus on interacting with web services.

* Add a mechanism to load remote XML data.


Loading mentions Retweet

Comments [0]

Jul

29

Nouveau Casino, Paris

Loading mentions Retweet

Comments [0]

Oct

28

Prototyping new business cards

Loading mentions Retweet

Comments [0]

Oct

20

Lack of updates

I haven't had much time to spare lately. I moved to France, things should settle down next month.

Loading mentions Retweet

Comments [0]

Sep

9

Esoteric Framework 0.2.0 released

I just pushed version 0.2.0 of the Esoteric Framework. It adds support for 2D lines and curves, among other things.

Here are the release notes:

===============================================================================
= E S O T E R I C F R A M E W O R K v 0 . 2 . 0 R E L E A S E N O T E S =
===============================================================================

__ Notes ______________________________________________________________________

* Template elements not included in this release because they rely on features
planned for later releases.
* Support for embedded fonts pushed back.

__ New in this release ________________________________________________________

* Added new Loader element to load external SWFs.
* Added new 2D line elements: LineStyle, LineGradientStyle, MoveTo, LineTo,
and CurveTo.
* Added new 2D drawing elements: Circle, and Ellipse.
* Added support for bitmap filters on 3D display objects.
* Added support for single-line and multi-line comments in scripts using
JavaScript/ActionScript syntax.
* Added NaN object to scripts context.
* Regenerated compiler lexer and parsers with Antlr 3.1.

__ Features planned for 0.3.0 _________________________________________________

The next release will focus on the manipulation of nodes using scripts.

* Add support for basic control structures in scripts (if, for, etc...).
* Add methods to dynamically manipulate nodes: clone, create, remove, move.


Loading mentions Retweet

Comments [1]

Sep

3

Django RC1 available

It seems the Django team has been busy lately. They released version 1.0 release candidate yesterday.

-- edit --

Version 1.0 was just released. That was fast!

Loading mentions Retweet

Comments [0]

Sep

2

Google Chrome is pretty neat

Nice minimal interface, very fast, I like =)

Loading mentions Retweet

Comments [0]

"}; var fb_comment_action_link_11135708 = [{"text":"Read more on Posterous","href":"http://stephan83.com/esoteric-framework-updates"}];