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

              
                .container#heart-container
	%input.heart{:type => 'checkbox'}
	
.container#star-container
	%input.star{:type => 'checkbox'}
	
.container#thup-container
	%input.thup{:type => 'radio', :name => 'like'}
	
.container#thdwn-container
	%input.thdwn{:type => 'radio', :name => 'like'}
              
            
!

CSS

              
                html, body
	position absolute
	top 0
	left 0
	width 100%
	height 100%
	margin 0
	padding 0
	
body
	display flex
	justify-content center
	align-items center
	background-color #F2F2F8

.container
	position relative
	margin 100px
	
input[type='checkbox'], input[type='radio']
	position relative
	width 0
	height 0
	z-index 999
	outline none
	&::before
		display block
		position absolute
		top 50%
		left 50%
		font-family 'FontAwesome'
		font-size 100px
		color #9E9E9E
		cursor pointer
		transform translate3D(-50%, -50%, 0)
		transition color .15s, transform .15s
		z-index 999
	&:checked::before
		animation-name scalePop
		animation-duration .4s
		animation-iteration-count 1
		animation-timing-function cubic-bezier(0.1, 1, 0.3, 1)
	&.heart
		&::before
			content '\f004'
		&:checked::before
			color #F44336
	&.star
		&::before
			content '\f005'
		&:checked::before
			color #FFA000
	&.thup
		&::before
			content '\f164'
			transform-origin left center
		&:checked::before
			animation-name wiggleUp
			color #2196F3
	&.thdwn
		&::before
			content '\f165'
			transform-origin left center
			transform translate3D(50%, -50%, 0) scale3D(-1, 1, 1)
		&:checked::before
			animation-name wiggleDown
			color #212121
		
@keyframes scalePop
	from
		transform translate3D(-50%, -50%, 0) scale3D(0, 0, 1)
	to
		transform translate3D(-50%, -50%, 0) scale3D(1, 1, 1)
		
@keyframes wiggleUp
	from
		transform translate3D(-50%, -50%, 0) scale3D(0, 0, 1) rotateZ(45deg)
	to
		transform translate3D(-50%, -50%, 0) scale3D(1, 1, 1) rotateZ(0deg)
		
@keyframes wiggleDown
	from
		transform translate3D(50%, -50%, 0) scale3D(0, 0, 1) rotateZ(-45deg)
	to
		transform translate3D(50%, -50%, 0) scale3D(-1, 1, 1) rotateZ(0deg)
              
            
!

JS

              
                heart_container = document.getElementById 'heart-container'
heart_checkbox = heart_container.querySelector 'input'

star_container = document.getElementById 'star-container'
star_checkbox = star_container.querySelector 'input'

thup_container = document.getElementById 'thup-container'
thup_checkbox = thup_container.querySelector 'input'

thdwn_container = document.getElementById 'thdwn-container'
thdwn_checkbox = thdwn_container.querySelector 'input'

heart_tweens = [
	new mojs.Shape({
		parent: heart_container,
		left: '50%', top: '48%',
		radius: { 10: 65 },
		fill: 'transparent',
		stroke: { '#F57C00': '#D32F2F' },
		strokeWidth: { 30: 0 },
		duration: 800,
		easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
	}),
	new mojs.Burst({
		parent: heart_container,
		left: '50%', top: '48%',
		radius: { 40: 110 },
		count: 6,
		children: {
			shape: 'line',
			fill: 'white',
			radius: { 30: 0 },
			scale: 1,
			stroke: {'#FFA000': '#E91E63'},
			strokeWidth: 2,
			duration: 650,
			delay: 200,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	}),
	new mojs.Burst({
		parent: heart_container,
		left: '50%', top: '48%',
		radius: { 20: 100 },
		angle: 30,
		count: 6,
		children: {
			shape: 'circle',
			fill: {'#E91E63': '#FFA000'},
			radius: { 30: 0 },
			scale: 1,
			strokeWidth: 2,
			duration: 1200,
			delay: 250,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	})
]

star_tweens = [
	new mojs.Shape({
		parent: star_container,
		left: '50%', top: '75%',
		radius: { 10: 50 },
		fill: 'transparent',
		stroke: { '#FF5722': '#FFA000' },
		strokeWidth: { 30: 0 },
		duration: 800,
		easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
	}),
	new mojs.Shape({
		parent: star_container,
		left: '50%', top: '75%',
		radius: { 10: 70 },
		fill: 'transparent',
		stroke: { '#FF5722': '#FFA000' },
		strokeWidth: { 30: 0 },
		duration: 800,
		delay: 200
		easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
	}),
	new mojs.Burst({
		parent: star_container,
		left: '50%', top: '50%',
		radius: { 20: 80 },
		angle: 0,
		count: 5,
		children: {
			shape: 'line',
			fill: 'white',
			radius: { 35: 0 },
			scale: 1,
			stroke: {'#E64A19': '#FFEB3B'},
			strokeWidth: 2,
			duration: 650,
			delay: 250,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	}),
	new mojs.Burst({
		parent: star_container,
		left: '50%', top: '50%',
		radius: { 20: 100 },
		angle: 36,
		count: 5,
		children: {
			shape: 'line',
			fill: 'white',
			radius: { 80: 0 },
			scale: 1,
			stroke: {'#FBC02D': '#F57C00'},
			strokeWidth: 2,
			duration: 800,
			delay: 150,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	})
]

thup_tweens = [
	new mojs.Burst({
		parent: thup_container,
		left: '50%', top: '50%',
		radius: { 0: 80 },
		angle: -45,
		degree: 90,
		count: 10,
		children: {
			shape: 'line',
			stroke: { '#303F9F': '#03A9F4' },
			radius: { 30: 0 },
			scale: 1,
			duration: 750,
			delay: 150,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	})
]

thdwn_tweens = [
	new mojs.Burst({
		parent: thdwn_container,
		left: '50%', top: '50%',
		radius: { 10: 90 },
		angle: 180 - 45,
		degree: 90,
		count: 10,
		children: {
			shape: 'line',
			stroke: { '#212121': '#F44336' },
			radius: { 30: 0 },
			scale: 1,
			duration: 750,
			delay: 150,
			easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
		}
	})
]

heart_timeline = new mojs.Timeline({ speed: 1 })
heart_timeline.add(heart_tweens)
heart_checkbox.addEventListener 'click', (e) ->
	if heart_checkbox.checked
		heart_timeline.replay()
		
star_timeline = new mojs.Timeline({ speed: 1 })
star_timeline.add(star_tweens)
star_checkbox.addEventListener 'click', (e) ->
	if star_checkbox.checked
		star_timeline.replay()
		
thup_timeline = new mojs.Timeline({ speed: 1 })
thup_timeline.add(thup_tweens)
thup_checkbox.addEventListener 'click', (e) ->
	if thup_checkbox.checked
		thup_timeline.replay()
		
thdwn_timeline = new mojs.Timeline({ speed: 1 })
thdwn_timeline.add(thdwn_tweens)
thdwn_checkbox.addEventListener 'click', (e) ->
	if thdwn_checkbox.checked
		thdwn_timeline.replay()
              
            
!
999px

Console