function CoverLayout(context, options) {

        //
        // Prepare
        //
        size = context.size;
        zOffset = options.zOffset;
        itemAngle = options.itemAngle;
        direction = context.direction;
        revDirection = direction ? 0 : 1;
        itemSize = options.itemSize || (size[direction] / 2);
        radialOpacity = (options.radialOpacity === undefined) ? 1 : options.radialOpacity;

        //
        // reset size & translation
        //
        set.opacity = 1;
        set.size[0] = size[0];
        set.size[1] = size[1];
        set.size[revDirection] = itemSize;
        set.size[direction] = itemSize;
        set.translate[0] = 0;
        set.translate[1] = 0;
        set.translate[2] = 0;
        set.rotate[0] = 0;
        set.rotate[1] = 0;
        set.rotate[2] = 0;
        set.scrollLength = itemSize;

        //
        // process next nodes
        //
        offset = context.scrollOffset;
        bound = (((Math.PI / 2) / itemAngle) * itemSize) + itemSize;
        while (offset <= bound) {
            node = context.next();
            if (!node) {
                break;
            }
            if (offset >= -bound) {
                set.translate[direction] = offset;
                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
                }
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
                context.set(node, set);
            }
            offset += itemSize;
        }

        //
        // process previous nodes
        //
        offset = context.scrollOffset - itemSize;
        while (offset >= -bound) {
            node = context.prev();
            if (!node) {
                break;
            }
            if (offset <= bound) {
                set.translate[direction] = offset;
                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
                }
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
                context.set(node, set);
            }
            offset -= itemSize;
        }
    }
function CoverLayout(context, options) {

        
        
        
        size = context.size;
        zOffset = options.zOffset;
        itemAngle = options.itemAngle;
        direction = context.direction;
        revDirection = direction ? 0 : 1;
        itemSize = options.itemSize || (size[direction] / 2);
        radialOpacity = (options.radialOpacity === undefined) ? 1 : options.radialOpacity;

        
        
        
        set.opacity = 1;
        set.size[0] = size[0];
        set.size[1] = size[1];
        set.size[revDirection] = itemSize;
        set.size[direction] = itemSize;
        set.translate[0] = 0;
        set.translate[1] = 0;
        set.translate[2] = 0;
        set.rotate[0] = 0;
        set.rotate[1] = 0;
        set.rotate[2] = 0;
        set.scrollLength = itemSize;

        
        
        
        offset = context.scrollOffset;
        bound = (((Math.PI / 2) / itemAngle) * itemSize) + itemSize;
        while (offset <= bound) {
            node = context.next();
            if (!node) {
                break;
            }
            if (offset >= -bound) {
                set.translate[direction] = offset;
                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
                }
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
                context.set(node, set);
            }
            offset += itemSize;
        }

        
        
        
        offset = context.scrollOffset - itemSize;
        while (offset >= -bound) {
            node = context.prev();
            if (!node) {
                break;
            }
            if (offset <= bound) {
                set.translate[direction] = offset;
                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
                }
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
                context.set(node, set);
            }
            offset -= itemSize;
        }
    }
function CoverLayout ( context , options ) { // // Prepare // size = context . size ; zOffset = options . zOffset ; itemAngle = options . itemAngle ; direction = context . direction ; revDirection = direction ? 0 : 1 ; itemSize = options . itemSize || ( size [ direction ] / 2 ) ; radialOpacity = ( options . radialOpacity === undefined ) ? 1 : options . radialOpacity ; // // reset size & translation // set . opacity = 1 ; set . size [ 0 ] = size [ 0 ] ; set . size [ 1 ] = size [ 1 ] ; set . size [ revDirection ] = itemSize ; set . size [ direction ] = itemSize ; set . translate [ 0 ] = 0 ; set . translate [ 1 ] = 0 ; set . translate [ 2 ] = 0 ; set . rotate [ 0 ] = 0 ; set . rotate [ 1 ] = 0 ; set . rotate [ 2 ] = 0 ; set . scrollLength = itemSize ; // // process next nodes // offset = context . scrollOffset ; bound = ( ( ( Math . PI / 2 ) / itemAngle ) * itemSize ) + itemSize ; while ( offset <= bound ) { node = context . next ( ) ; if ( ! node ) { break ; } if ( offset >= - bound ) { set . translate [ direction ] = offset ; set . translate [ 2 ] = Math . abs ( offset ) > itemSize ? - zOffset : - ( Math . abs ( offset ) * ( zOffset / itemSize ) ) ; set . rotate [ revDirection ] = Math . abs ( offset ) > itemSize ? itemAngle : ( Math . abs ( offset ) * ( itemAngle / itemSize ) ) ; if ( ( ( offset > 0 ) && ! direction ) || ( ( offset < 0 ) && direction ) ) { set . rotate [ revDirection ] = 0 - set . rotate [ revDirection ] ; } set . opacity = 1 - ( ( Math . abs ( angle ) / ( Math . PI / 2 ) ) * ( 1 - radialOpacity ) ) ; context . set ( node , set ) ; } offset += itemSize ; } // // process previous nodes // offset = context . scrollOffset - itemSize ; while ( offset >= - bound ) { node = context . prev ( ) ; if ( ! node ) { break ; } if ( offset <= bound ) { set . translate [ direction ] = offset ; set . translate [ 2 ] = Math . abs ( offset ) > itemSize ? - zOffset : - ( Math . abs ( offset ) * ( zOffset / itemSize ) ) ; set . rotate [ revDirection ] = Math . abs ( offset ) > itemSize ? itemAngle : ( Math . abs ( offset ) * ( itemAngle / itemSize ) ) ; if ( ( ( offset > 0 ) && ! direction ) || ( ( offset < 0 ) && direction ) ) { set . rotate [ revDirection ] = 0 - set . rotate [ revDirection ] ; } set . opacity = 1 - ( ( Math . abs ( angle ) / ( Math . PI / 2 ) ) * ( 1 - radialOpacity ) ) ; context . set ( node , set ) ; } offset -= itemSize ; } }
CoverLayout
CoverLayout