Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
	<meta charset="utf-8">
	<title>LG_G4_+_FREE_LG_SM</title>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<!--<script src='lib/TweenMax.js'></script>-->
	<style type="text/css" >



	
	</style>

</head>
<body>
	
	<div id="container_dc">
		<div id="content_dc">
			<div id="animation">

			<svg id="soundWaves" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1400px" height="400px" viewbox="0 0 1400 400" enable-background="new 0 0 1400 400" xml:space="preserve">
				
				<g id="rect0">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect1">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect2">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect3">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect4">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect5">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect6">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect7">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect8">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>
				<g id="rect9">
<rect x="0" y="0" rx="5" ry="5" width="150" height="30" style="fill:red;stroke:black;stroke- width:5;opacity:1" />				</g>

			</svg>
			</div>
		</div>
	</div>
</body>
              
            
!

CSS

              
                #loading_dc {
	position:absolute;
	opacity:0;
	left:0;
	top:0;
}
#container_dc {
	position: absolute;
	border:1px solid #9b9b9b;
	width:1400px;
	height:400px;
	top: 0px;
	left: 0px;
	margin: auto;
/*	overflow:hidden;
*/}
#content_dc {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0px;
	left: 0px;
	/*z-index: 100*/
	background:#abff00;
/*	overflow:hidden;
*/	font-family:Arial, Helvetica, sans-serif;
	color:#fff;
	font-size:15px;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	/*background:transparent url(spritesMPU.png) repeat-x top left;*/
}

/* Invisible button for background clickthrough. */
#background_exit_dc {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0px;
	left: 0px;
	cursor: pointer;
	opacity: 0;
	z-index: 1000;
}

#contrastBorder{
	position:absolute;
	top:0;
	left:0;
	opacity:1;
	/*z-index:800;*/
}
#wrapper{
	position:absolute;
/*	overflow: hidden;
*/	top:0;
	left:0;
	width:300px;
	height: 250px
}
#bg, #pulseMask, #pulseMask2 {
	position:absolute;
	top:0;
	left:0;
	width:300px;
	height: 250px;
}

#animation{
	position: absolute;
	width: 298px;
	height:248px;
	top: 0px;
	left: 0px;
}

.hidden{
	visibility: hidden;
}
.headline{
	position: absolute;
	display: block;
	left:16px;
	font-size: 19px;
	line-height: 1.2;
	letter-spacing: 1.1px;
	font-weight: 100;
	text-align: left;
}
#headline1{
	z-index: 220;
	opacity:0;
	top:13px;
}
#headline2{
	z-index: 230;
	opacity:0;
	top:38px;
}
#headline3{
	z-index: 240;
	opacity:0;
	top:84px;
	font-size: 10px;
	letter-spacing: 1.1px;
}




#cta{
	position: absolute;
    left: 13px;
    top: 215px;
    opacity: 0;
    z-index: 260;
}

#phone1{
	position: absolute;
	z-index: 250;
	left:195px;
	top:61px
}

.speaker{
	position: absolute;
	opacity:1;
	z-index: 260;
	left:134px;
	top:81px
}
#speaker1{
	-webkit-transform: translate3d(0, 0, 0);
	z-index: 260;

}
#speaker2{
	-webkit-transform: translate3d(0, 0, 0);
	z-index: 265;

}

#soundWaves{

	-webkit-transform: translate3d(0, 0, 0);
	position: absolute;
	opacity:1;
	z-index: 300;
}

#soundWave1{
	-webkit-transform: translate3d(0, 0, 0);

}


#plextrumSVG{
	position: absolute;
	z-index: 500;
	width:100px;
	height:100px;

	left:5px;
	top:105px;
}

#plectrumCopy{

	position: absolute;
	z-index: 510;
	opacity: 0;
	left:25px;
	top:125px;
}





#legalbut, #legalclose{
	display:block;
	border: 1px;
	position:absolute;
	bottom: 0px;
	right: 8px;
	cursor:pointer;
	z-index:1010;
}
#legalclose{
	z-index:1050;
}
#legals{
	position:absolute;
	bottom:-250px;
	left:0;
	right:0;
	font-family:Helvetica, Arial, sans-serif;
	font-size: 10px;
	text-align:left;
	color:#fff;
	/*background:url(LegalBG_tile.png) left top;
	background-repeat: repeat-x;*/
	-webkit-transition:bottom 0.5s ease;
	transition:bottom 0.5s ease;
	z-index:1025;
	cursor:pointer;
}
#legals p{
	padding:0;
	margin:0;
	line-height:12px;
	width : 90%;
}
#legalTextContent{
	border-top:1px solid #fff;
	width:100%;
	padding:21px 0px 30px 10px;
	background: #b81527;
	/*background:url(patternSmallerPinkPattern.png) repeat left top;*/
}

              
            
!

JS

              
                var points = 360;
		var radius = 50;
		var x0 = 100; // makes the shape distort
		var y0 = 100; // makes the shape distort
		//
		var viewpointx = 0; // this is where your eye is ( if we compare where your 
		var viewpointy = 0; // eye would look, we can work out the scale and position )
		//
		var plusx = 300; // position the centre in 2D
		var plusy = 0; // position the centre in 2D

		var clipsArray = [];
		var numberofclips;

		var rotation = 0;


		init();

		function init(){
		

		// var init = function(){
			
			qAngle = Math.PI * 2 / points;
						//
			depths_top = radius + x0
			depths_bot = radius - x0;
			depths_range = depths_top - depths_bot;
			
			
			createClips();
			
			animate();
			
		}

		function createClips(){
			
			clipsArray = new Array();

			for( var c = 0 ; c < 10 ; c++ ){
				
				var newclipname = "rect"+c;
				var ypos = c * 30;
				var depth = c + 50;

				var clip = document.getElementById( newclipname );

				//console.log( "Clips = " + newclipname );

				clipsArray[c] = clip;
				
				//setUpButton( clip );

				plotpoint(c,clip)
				
			};
			
			numberofclips = clipsArray.length;

			//console.log( "number of Clips = " + numberofclips );

			//console.log( "finddistance 1, 2, 10, 20 = ( point 1, point 2, distance, scale )" + finddistance( 1, 2, 10, 20 ) );
		}

		// make a function which rotates the clips into their final position and uses inertia to stop	
		//------------------------------------------------------------------------
		//------------------------------------------------------------------------
		//------------------------------------------------------------------------
		function plotpoint( k, clip ){
			
			// translate the circular motion and position of the
			// clip in question into distance and scale values for positioning the clip
			var newx = x0 + radius * Math.cos( qAngle * k );
			var newy = y0 + radius * Math.sin( qAngle * k );
			// get the distance between the two points and the scale
			var output = finddistance( viewpointx, viewpointy, newx, newy, k );
			// position the 'clip' according to the 'output' and the offset values (plusx, plusy);
			positionmc( output, plusx, plusy, clip, k );


		}
		
		
		
		// //------------------------------------------------------------------------
		// //----------in v1, v2 - coordinates XY  p1, p2 coordinates XY ------------
		// //------------------------------------------------------------------------
		// //----------return - distance --------------------------------------------
		function finddistance(v1, v2, p1, p2){
			// lots of Pythagoras - to find the distance between the defined viewpoint and the clip in question
			var xdist = Math.abs( p1 - v1 );
			var ydist = Math.abs( v2 - p2 );
			//
			var xdistsquared = xdist * xdist;
			var ydistsquared = ydist * ydist;
			//
			var sumofthesquare = xdistsquared + ydistsquared;
			var distance = Math.round(Math.sqrt(sumofthesquare));
			var scale = Math.round(distance/1);
			var positionarray = new Array( p1, p2, distance, scale);
			return positionarray;
		}
		
		
		
		// //------------------------------------------------------------------------
		// //------------------------------------------------------------------------
		// //------------------------------------------------------------------------
		function positionmc( output, plusx, plusy, clip, angleOfClipPosition ){
			// this function actually positions the movie clips
			var newx = output[0];
			var newy = output[1];
			var distance = output[2];
			var scale = output[3]/100;
			// angleOfClipPosition is how far the clip is around the edge of the circle it lives on - not the actual angle of the clip
			var angleOfClip = angleOfClipPosition;//  * ( Math.PI / 180 );

			var newClipY = newy + plusy;
			var newClipX = 50 + plusx;
			var newScaleX = scale;
			var newScaleY = scale;
			var calcalpha  = 1;//distance - ( depths_top - depths_range  ) + 20;

			alterClipProperties( clip, newClipX, newClipY, newScaleX, newScaleY, angleOfClip, calcalpha, distance );

			//depthsSort ( clip, distance );



			// //clip.thetxt = clip.deftext + "dist_" + distance;
			// clip.swapDepths( distance );
			// // trace("clip to position = "+this[clip]+" >> 
			// // newx = "+newx+" >> newy = "+newy+ " >> distance = "+distance+" >> scale = "+scale);
		}

		function alterClipProperties( clip, newClipX, newClipY, newScaleX, newScaleY, angleOfClip, newAlpha, distance ){

			//clip._y = newClipY;
			//clip._x = 50 + plusx; // this can make the buttons look offset in 3D
			//clip._xscale = newScaleX;
			//clip._yscale = newScaleY;
			
			//console.log( " calcalpha = " + clip, newClipX, newClipY, newScaleX, newScaleY, newAlpha  );
			//clip._alpha = calcalpha;

			var newZIndex = distance;
			console.log( "newZIndex = " + newZIndex + " scale = " + newScaleX + " angleOfClip = " + angleOfClip );

			TweenMax.set(  clip,  {    x:newClipX, y:newClipY, scale:newScaleX, rotationZ:angleOfClip ,autoAlpha:newAlpha, transformOrigin: "50% 50%", zIndex:newZIndex });

		}

		function animate(){

			rotation = 0;

			TweenMax.to(  this, 3, {   rotation:300, onUpdate:updateRotation, onComplete: onComplete,
  onReverseComplete: onComplete });

		}

function onComplete() {
  this.reversed(!this.reversed());
}

		function updateRotation(){

			//console.log( "r = " + rotation );

			for( var c = 0 ; c < numberofclips ; c++ ){
				var clipToPosition = clipsArray[c];
				var clipRotation = rotation + ( ( 360 / numberofclips ) * c );
				plotpoint( clipRotation, clipToPosition );
			}

			

			
		}
              
            
!
999px

Console