Pen Settings

HTML

CSS

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                a(class='signature', href='http://vanderlanth.io' target='_blank') Made with ♥ by vanderlanth

mixin section(text, classes, info)
	section(class=classes)
		.container
			.text.hidden=text
		.show Show
		.hide hide
		.infos=info


.intro
	h1 Micro Interactions
	small Here are some explorations I did just for fun. I will try to add more of them soon. Feel free to participate or to give your feedback, cheers ! 👾 
+section('Parallax', 'parallax', 'Tips: Move your mouse')
+section('Blur', 'blur', 'Tips: Hover the text')
+section('Gradient', 'gradient', '')
+section('Ghost', 'ghost', '')
+section('Ghost Hover', 'ghost-hover', 'Tips: Hover the text')
+section('Combo', 'gradient-blur', 'Tips: Hover the text')
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Space+Mono'

//BASE======================================================================
html, body
	width: 100vw
	height: 100vh
	background: black
	display: flex
	flex-flow: row wrap
	justify-content: center
	align-items: flex-start
	align-content: flex-start
	//overflow: hidden
	margin: 0
	padding: 0
	font-family: 'Space Mono'
	font-weight: 100 


.signature
	position: fixed
	font-family:  sans-serif
	font-weight: 100
	bottom: 10px
	left: 0
	letter-spacing: 4px
	font-size: 10px
	width: 100vw
	text-align: center
	color: white
	text-transform: uppercase
	text-decoration: none


.intro
	margin-top: 20vh
	width: 100vw
	height: 30vh
	border-bottom: 1px solid rgba(white, 0.2)
	color: white
	position: relative
	display: flex
	flex-flow: column wrap
	justify-content: center
	align-items: flex-start
	align-content: center
	padding: 0 10vw
	h1
		font-weight: 100 !important
		font-size: 24px
		text-transform: uppercase
		letter-spacing: 5px
		opacity: .4
	small
		font-weight: 100 !important
		max-width: 410px
		filter: hue-rotate(180deg)

section
	width: 100vw
	height: 650px
	border-bottom: 1px solid rgba(white, 0.2)	
	position: relative
	display: flex
	flex-flow: row wrap
	justify-content: center
	align-items: center
	.container
		position: relative
		display: flex
		flex-flow: row wrap
		justify-content: center
		align-items: center
		width: 100%
		height: 100%
		//transform: scale(2)
	.hide, .show
		color: white
		font-size: 14px
		position: absolute
		bottom: 0px
		right: 10px
		padding: 8px
		transition: .2s ease all
		opacity: .4
		cursor: pointer
		&:hover
			opacity: 1
	.show
		right: 60px
	.infos
		color: white
		font-size: 14px
		position: absolute
		bottom: 8px
		left: 8px
		cursor: default
		user-select: none
		opacity: .5
	.text
		color: white
		font-family: sans-serif
		font-weight: 100
		cursor: pointer
		letter-spacing: 10px
		text-transform: uppercase
	
//======================================================================

.blur .text
	transition: .4s ease all
	&:hover
		filter: blur(5px)
	&.hidden
		filter: blur(5px)
		opacity: 0

//======================================================================
	
.gradient .text
	background: linear-gradient(90deg, #eee 0%, #333 100%)
	-webkit-background-clip: text
	-webkit-text-fill-color: transparent
	background-size: 300%
	background-repeat-x: no-repeat
	transition: 1s ease all
	&.hidden
		background-size: 0%
		transition: .4s ease all

//======================================================================
		
.ghost .text
	background: linear-gradient(90deg, #333 0%, #eee 33%, #eee 66%, #333 100%)
	-webkit-background-clip: text
	-webkit-text-fill-color: transparent
	background-size: 300%
	transition: 2s ease all
	animation: ghost 5s linear infinite
	&.hidden
		opacity: 0
		transition: 1s ease all
	
@keyframes ghost
	0% 
		background-position: 0	
	100% 
		background-position: 300%

//======================================================================
		
.ghost-hover .text
	background: linear-gradient(90deg, #333 0%, #eee 33%, #eee 66%, #333 100%)
	-webkit-background-clip: text
	-webkit-text-fill-color: transparent
	background-size: 300%
	background-position: -100%	
	transition: 2s ease all
	&:hover
		background-position: 50%	
	&.hidden
		opacity: 0
		background-size: 900%
		transition: 1.5s ease all
	
//======================================================================
		
.gradient-blur .text
	background: linear-gradient(90deg, #333 0%, #eee 33%, #eee 66%, #333 100%)
	-webkit-background-clip: text
	-webkit-text-fill-color: transparent
	background-size: 300%
	background-position: -100%	
	transition: 2s ease all
	&:hover
		background-position: 50%
		//filter: blur(5px)
	&.hidden
		opacity: 0
		background-size: 900%
		transition: 1.5s ease all
		filter: blur(5px)
	
//======================================================================

.parallax .text
	position: relative
	transition: 1.5s ease all
	span
		margin: 0 10px
		transition: .4s ease all
		color: transparent
		user-select: none
		.ltr
			display: inline
			position: absolute
			color: white		
	
	.top, .bottom
		position: relative
	&.hidden
		filter: blur(3px)
		transform: scale(0.9)
		opacity: 0
	
              
            
!

JS

              
                console.clear();

$(document).ready(function(){
	$('.text').removeClass('hidden');
	
	$('.show').on('click', function(){
		$(this).parent().find('.text').removeClass('hidden');
	});
	
	$('.hide').on('click', function(){
		$(this).parent().find('.text').addClass('hidden');
	});
	
	
	
	
	
	//parallax text section
	var txt = $('.parallax .text').text();
	console.log(txt);
	$('.parallax .text').text('');
	
	for(var i = 0; i < txt.length; i++){
		var ltr = txt[i];
		var classes;
		var dec;
		var dist = Math.floor(Math.random() * 20);
		
		if(i % 2 != 0){
			classes = 'bottom';
			dec = Math.floor(Math.random() * 20);
		}
		else{
			classes = 'top';
			dec = Math.floor(Math.random()*20) * (-1);
		}
		
		var span = "<span class=" + classes + " style='top:" + dec + "px; font-size:" + ( 12 +(dist) ) + "px' data-dist=" + dist + ">" + ltr + "<div class='ltr'>" + ltr + "</div></span>";
		$('.parallax .text').append(span);
		
		if(12 +(dist*2) <= 30){
			$('.parallax .text span').last().css('filter', 'blur(1px)');
		}
	}
	
	$('.parallax .container').on('mousemove', function(event){
		var x = (event.pageX / $( window ).width() * 100) - 50;
		var y = ((event.pageY - $('.parallax').offset().top) / 650 * 100) - 50;
		$('.parallax .text span').each(function(i){
			var thisdist = $(this).attr('data-dist');
			$(this).find('.ltr').css('transform', 'translate(' + (x/10*thisdist) +'px, ' + (y/10*thisdist) +'px)');
		});
	});
	
	
});

              
            
!
999px

Console