123

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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>UI 005 - mail</title>
		<link href='https://fonts.googleapis.com/css?family=Roboto:500' rel='stylesheet' type='text/css'>
	</head>
	<body>
		<div class="icon">
			<div class="notification">0</div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
			<div class="spark"></div>
		</div>
	</body>
	
	<script src="js/main.js"></script>
</html>	
            
          
!
            
              
$mail-clr: #008be5;
$yell-clr: #edb51c;

@mixin centerer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) ;
}

body{
	background: darken($mail-clr, 20%);
}

.icon{
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) rotate(0deg);
	width: 160px;
	height: 160px;
	background-image: url(http://dariographics.com/DUI/005/mail_logo_02.svg);
	background-position: right 0 bottom 6px;
	background-color: $mail-clr;
	border-radius: 30px;
}
.notification{
	position: absolute;
	top: -20px;
	left: 136px;
	font-family: 'Roboto', sans-serif;
	font-weight: bold;
	text-align: left;
	font-size: 26px;
	padding: 10px 16px;
	border-radius:40px;
	background-color: $yell-clr;
	background-positionY: right 0 bottom 6px;
}


.spark{
	position:absolute;
	opacity:0;
	top: -30px;
	left:76px;
	width:7px;
	height:40px;
	border-radius:3px;
	border-radius:5px;
	background-image: linear-gradient($mail-clr 10%, rgba(255,255,255,0)20%);
	transform-origin: 6px 110px;
	@for $i from 1 through 9 {
    &:nth-child(#{$i}) {
    	transform: scale(0.5) rotate(0deg + ($i*-45));
    	// top: random(50) + 320px;
    	// left:random(50) + -1120px + ($i*160);
	}
}
}

// .ic-an{
// 	animation: mailicon 0.4s;
// }

// @keyframes mailicon {
// 	50%{
// 		background-image: linear-gradient($yell-clr 1%, rgba(255,255,255,0));
// 	}
// }
            
          
!
            
              // okay, lets do this)
// First we creating vars for simplicity code

var count = 0;
var icon = $('.icon');
var noty = $('.notification');
var spark = $('.spark');

// Second - creating timeline with GASP jquery plugin in 'anim' function

function anim(){
	var randrot = Math.random() * 40 -30; // this is randomize rotate angle when icon jump
	var tl = new TimelineMax(); // this is var for timeline
	var tlNoty = new TimelineMax();
	
	// timeline for icon animation
	
	tl.to(icon, 0.5, {
		backgroundPositionY: '-154'+'px' // move mail icon in icon
	})
	.to(icon, 0.0, {
		backgroundPositionY: '0'+'px'
	})
	.to(icon, 0.4, {
		top: '45%', // jump
		rotation: 10 + randrot, // random rotate
		ease: Power4.easeOut
	}, "-=0.6")
	.to(icon, 0.8, { // in this step we are back to original state
		top: '50%',
		rotation:"0",
		backgroundColor: '#008be5',
		ease: Elastic.easeOut.config(0.8, 0.3)
	}, "-=0.4")
	.to(icon, 1.6, {
		backgroundColor: '#00b4ff',
		ease: Power4.easeOut
	}, "-=2.4")
	
	// and on this timiline add sparks animation
	
	.to(spark, 0.4, {
		opacity: '1',
		scale: 1.3,
		ease:  Power4.easeIn
	}, '-=1.5')
	.to(spark, 0.3, {
		opacity: '0',
		scale: 1,
		ease:  Power4.easeOut
	}, '-=0.75'); // '-=0.75' - move step in timeline
	
	// and timeline for sparks and notification
	
	tlNoty.to(noty, 1, {
		backgroundColor: '#fffc00',
		ease:  Power4.easeOut
	})
	.to(noty, 1, {
		backgroundColor: '#edb51c',
		ease:  Power4.easeOut
	});
	
	// if count in notification > 1000 we are set count to zero
	
	if (count > 10){
		count = 0
	}
	
}

// but we need loop the animation, and there setInterval help us)

setInterval(function() {
	count++ // plus one to count
	$('.notification').text(count); // set value to count
	anim(); // run timeline animation
}, 2500);

// Done!)

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console