Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <main id="app">
	<msg v-on:add-tl="addToMaster" v-bind:amount="50">{{ message }}</msg>
	<msg v-on:add-tl="addToMaster" v-bind:amount="-50">Good day</msg>
	<msg v-on:add-tl="addToMaster" v-bind:amount="50">Who are you</msg>

<script type="text/x-template" id="msg">
		<h1><slot></slot> <span>{{name}}</span></h1>


                * {
	box-sizing: border-box;

html {
	margin: 0;

body {
	margin: 0;
	background: hsl(0,0%,90%);
	display: flex;
	min-height: 100vh;
	color: hsl(0,0%,5%);

main {
	background: hsl(0,0%,98%);
	min-width: 50%;
	min-height: 50vh;
	margin: auto;
	box-shadow: 0px 0px 20px hsla(0,0%,0%,0.2);
	display: flex;
	flex-direction: column;
	visibility: hidden;
	padding: 1rem;

section {
	margin: 1rem auto;
	border: 1px solid hsl(0,0%,75%);
	padding: 2rem;

h1 {
	margin: 0;

h1 > span {
	font-style: italic;
	color: hsl(0,0%,10%);


                function moveSideways( el, amount ) {
	return el, 1, { xPercent:amount, ease:Power2.easeInOut } );

Vue.component( 'msg', {
	template: '#msg',
	props: [ 'amount' ],
	data() {
		return {
			name: 'Stranger',
			myTl: new TimelineLite(),
	mounted() {
		console.log( 'component mounted', this.amount )
		this.myTl.add( moveSideways( this.$el, this.amount ) )
		this.$emit( 'add-tl', { tl:this.myTl, position:'-=0.5' } )
} )

const app = new Vue( {
	el: '#app',
	data() {
		return {
			message: 'Hello',
			masterTl: new TimelineLite( { paused:true } )
	beforeMount() {
		console.log('app beforeMount')
		// This would be the perfect place to add stuff to the master timeline. But, alas, we do not have access to the DOM here.

	mounted() {
		console.log('app mounted')
		// We do have access to the DOM but all children are called before this component is called.
		// So... We cheat and push this to the very start of the timeline using the position parameter
		// Which kind of backfires as the first animation is also added at time 0
		// this.masterTl.from(this.$el, 1, {yPercent:25, ease:Linear.easeNone}, 0)
		// Then we try again, with .shiftChildren()
		const tl = new TimelineLite() this.$el, 2, {autoAlpha:1, ease:Linear.easeNone } )
		tl.from( this.$el, 1, { yPercent:25, ease:Power2.easeInOut }, '-=0.5')
		this.masterTl.shiftChildren( tl.totalDuration() )
		// this.masterTl.shiftChildren( tl.totalDuration() - 0.75 ) // Or this to create some overlap
		this.masterTl.add( tl, 0 )
		// Score!
		// wait until all children components have initialized
		this.$nextTick( function() {
			console.log('App next tick')


	methods: {
		addToMaster( payload ) {
			console.log('addToMaster', payload.position)
			this.masterTl.add(, payload.position)

} )