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

Save Automatically?

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

              
                <div id="intro-text">
	<div>Greensock's Draggable tool latest update now works on objects that have CSS transform applied to them, good luck trying to do this with another tool. Play around and see it for yourself.</div>

	<div style="text-align:right;">For more information visit: <a href="https://greensock.com">Greensock.com</a></div>
</div>

<div id="log-div">
	Current position ->  X: <span id="childX">0</span> -- Y: <span id="childY">0</span>
</div>

<div>

	<!-- rotate buttons -->
	<button id="rotate1">Rotate Parent to 45</button><button id="rotate2">Rotate Parent to 180</button> <button id="rotate3">Rotate Parent to 0</button><br>
	<!-- scale buttons -->
	<button id="scale1">Scale Parent to 1.5</button><button id="scale2">Scale Parent to 0.5</button><button id="scale3">Scale Parent to 1</button><br>
	<!-- skew buttons -->
	<button id="skew1">Skew X Parent 45deg</button><button id="skew2">Skew X Parent -45deg</button>
	<button id="skew3">Skew Y Parent 45deg</button><button id="skew4">Skew Y Parent -45deg</button><button id="skew5">Skew Parent to 0</button><br>
	<!-- 3D rotation buttons -->
	<button id="rotateX1">RotateX Parent 45 deg</button><button id="rotateX2">RotateX Parent -45 deg</button><button id="rotateX3">RotateX Parent to 0</button>
	<button id="rotateY1">RotateY Parent 45 deg</button><button id="rotateY2">RotateY Parent -45 deg</button><button id="rotateY3">RotateY Parent to 0</button>

</div>

<div id="wrapper">
	<div id="parent">
		
		<div id="div1"></div>

	</div>
</div>
              
            
!

CSS

              
                body
{
	background: #000;
	font: 16px "Trebuchet MS", Arial, Helvetica, sans-serif;
}

button
{
	padding: 2px 5px;
}

a
{
	color:#8DDF00;
	font-weight: bold;
}

#intro-text
{
	color: white;
	padding:5px 20px;
	border: solid 1px white;
	border-radius: 10px;
	margin-bottom: 10px;
}

#log-div
{
	padding: 5px;
	border: solid 1px white;
	width:70%;
	color: white;
	border-radius: 5px;
	margin-bottom: 10px;
}

#wrapper
{
	width: 600px;
	height: 400px;
	left:50%;
	margin-left: -300px;
	margin-top: 100px;
	position: relative;
}

#parent
{
	width:600px;
	height: 400px;
	background: #00f;
	position: relative;
	border-radius: 10px;
	border:solid 2px white;
	overflow: hidden;
}

#div1
{
	width: 100px;
	height: 100px;
	background: #8DDF00;
	position: relative;
	border-radius: 10px;
}
              
            
!

JS

              
                var rotate1 = $("#rotate1"),
	rotate2 = $("#rotate2"),
	rotate3 = $("#rotate3"),

	// Scale buttons
	scale1 = $("#scale1"),
	scale2 = $("#scale2"),
	scale3 = $("#scale3"),

	//skew buttons
	skew1 = $("#skew1"),
	skew2 = $("#skew2"),
	skew3 = $("#skew3"),
	skew4 = $("#skew4"),
	skew5 = $("#skew5"),

	//3D rotation buttons
	rotateX1 = $("#rotateX1"),
	rotateX2 = $("#rotateX2"),
	rotateX3 = $("#rotateX3"),
	rotateY1 = $("#rotateY1"),
	rotateY2 = $("#rotateY2"),
	rotateY3 = $("#rotateY3"),

	wrapper = $("#wrapper"),
	parent = $("#parent"),
	div1 = $("#div1"),
	childX = $("#childX"),
	childY = $("#childY");

//set wrapper perspective
TweenLite.set(wrapper,{perspective:500});

/** rotation buttons events **/
rotate1.click(function(e)
{
	TweenLite.to(parent, 1,{rotation:45});
});

rotate2.click(function(e)
{
	TweenLite.to(parent, 1,{rotation:180});
});

rotate3.click(function(e)
{
	TweenLite.to(parent, 1,{rotation:0});
});

/** scale buttons events **/
scale1.click(function(e)
{
	TweenLite.to(parent, 1,{scale:1.5});
});

scale2.click(function(e)
{
	TweenLite.to(parent, 1,{scale:0.5});
});

scale3.click(function(e)
{
	TweenLite.to(parent, 1,{scale:1});
});

/** skew buttons events **/
skew1.click(function(e)
{
	TweenLite.to(parent, 1,{skewX:45});
});
	
skew2.click(function(e)
{
	TweenLite.to(parent, 1,{skewX:-45});
});

skew3.click(function(e)
{
	TweenLite.to(parent, 1,{skewY:45});
});

skew4.click(function(e)
{
	TweenLite.to(parent, 1,{skewY:-45});
});

skew5.click(function(e)
{
	TweenLite.to(parent, 1,{skewX:0});
});

/** 3D rotation buttons events **/
rotateX1.click(function(e)
{
	TweenLite.to(parent, 1,{rotationX:45});
});		

rotateX2.click(function(e)
{
	TweenLite.to(parent, 1,{rotationX:-45});
});

rotateX3.click(function(e)
{
	TweenLite.to(parent, 1,{rotationX:0});
});

rotateY1.click(function(e)
{
	TweenLite.to(parent, 1,{rotationY:45});
});

rotateY2.click(function(e)
{
	TweenLite.to(parent, 1,{rotationY:-45});
});

rotateY3.click(function(e)
{
	TweenLite.to(parent, 1,{rotationY:0});
});

/** draggable instance **/
Draggable.create(div1,
{
	type:'x,y',
	bounds:parent,
	edgeResistance:1,
	onDrag:function()
	{
		childX.html(this.x);
		childY.html(this.y);
	}
});
              
            
!
999px

Console