function WheelLayout(context, options) {

		//
		// Prepare
		//
		size = context.size;
		direction = context.direction;
		revDirection = direction ? 0 : 1;
		itemSize = options.itemSize || (size[direction] / 2);
		diameter = options.diameter || (itemSize * 3);
		radius = diameter / 2;
        itemAngle = Math.atan2((itemSize / 2), radius) * 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] = size[revDirection];
        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) {
				angle = (offset / itemSize) * itemAngle;
				set.translate[direction] = radius * Math.sin(angle);
				set.translate[2] = (radius * Math.cos(angle)) - radius;
				set.rotate[revDirection] = direction ? -angle : angle;
                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) {
				angle = (offset / itemSize) * itemAngle;
				set.translate[direction] = radius * Math.sin(angle);
				set.translate[2] = (radius * Math.cos(angle)) - radius;
				set.rotate[revDirection] = direction ? -angle : angle;
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
				context.set(node, set);
			}
			offset -= itemSize;
		}
    }
function WheelLayout(context, options) {

		
		
		
		size = context.size;
		direction = context.direction;
		revDirection = direction ? 0 : 1;
		itemSize = options.itemSize || (size[direction] / 2);
		diameter = options.diameter || (itemSize * 3);
		radius = diameter / 2;
        itemAngle = Math.atan2((itemSize / 2), radius) * 2;
        radialOpacity = (options.radialOpacity === undefined) ? 1 : options.radialOpacity;

		
        
        
        set.opacity = 1;
        set.size[0] = size[0];
        set.size[1] = size[1];
        set.size[revDirection] = size[revDirection];
        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) {
				angle = (offset / itemSize) * itemAngle;
				set.translate[direction] = radius * Math.sin(angle);
				set.translate[2] = (radius * Math.cos(angle)) - radius;
				set.rotate[revDirection] = direction ? -angle : angle;
                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) {
				angle = (offset / itemSize) * itemAngle;
				set.translate[direction] = radius * Math.sin(angle);
				set.translate[2] = (radius * Math.cos(angle)) - radius;
				set.rotate[revDirection] = direction ? -angle : angle;
                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
				context.set(node, set);
			}
			offset -= itemSize;
		}
    }
function WheelLayout ( context , options ) { // // Prepare // size = context . size ; direction = context . direction ; revDirection = direction ? 0 : 1 ; itemSize = options . itemSize || ( size [ direction ] / 2 ) ; diameter = options . diameter || ( itemSize * 3 ) ; radius = diameter / 2 ; itemAngle = Math . atan2 ( ( itemSize / 2 ) , radius ) * 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 ] = size [ revDirection ] ; 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 ) { angle = ( offset / itemSize ) * itemAngle ; set . translate [ direction ] = radius * Math . sin ( angle ) ; set . translate [ 2 ] = ( radius * Math . cos ( angle ) ) - radius ; set . rotate [ revDirection ] = direction ? - angle : angle ; 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 ) { angle = ( offset / itemSize ) * itemAngle ; set . translate [ direction ] = radius * Math . sin ( angle ) ; set . translate [ 2 ] = ( radius * Math . cos ( angle ) ) - radius ; set . rotate [ revDirection ] = direction ? - angle : angle ; set . opacity = 1 - ( ( Math . abs ( angle ) / ( Math . PI / 2 ) ) * ( 1 - radialOpacity ) ) ; context . set ( node , set ) ; } offset -= itemSize ; } }
Wheel-layout
Wheel - layout