cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<div id="icons-wrapper" class="icon main">
	<div class="rainbow">
		<div></div>
		<div></div>
		<div></div>
		<div></div>
	</div>
	<div class="icon">
		<div class="sun"></div>
		<div class="moon start"></div>
		<div class="cloud cloud1">
			<div class="rain">
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
			</div>
			<img class="bolt one" src='https://image.flaticon.com/icons/svg/222/222506.svg'/>
		</div>
		<div class="cloud cloud2">
			<div class="rain">
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
				<div class=drop></div>
			</div>
			<img class="bolt two" src='https://image.flaticon.com/icons/svg/222/222506.svg'/>
		</div>
		<div class="wind"></div>
		<div class="hill"></div>
	</div>
</div>

<div id="menu">
	<div class="menu-option">
		<input id="sun" type="checkbox" />
		<label for="sun">SUN</label>
	</div>
	<div class="menu-option">
		<input id="clouds" type="checkbox" />
		<label for="clouds">CLOUDS</label>
	</div>
	<div class="menu-option">
		<input id="rain" type="checkbox" disabled/>
		<label for="rain">RAIN</label>
	</div>
	<div class="menu-option">
		<input id="wind" type="checkbox" disabled/>
		<label for="wind">WIND</label>
	</div>
	<div class="menu-option">
		<input id="lightning" type="checkbox"/>
		<label for="lightning">LIGHTNING</label>
	</div>
	<div class="menu-option">
		<input id="storm" type="button" value="STORM"></input>
	</div>
</div>
            
          
!
            
              body {
	background: #212121;
}

#menu {
	position: absolute;
	top: 0;
	left: 0;
	padding: 15px 15px 0 15px;
	background: #717171;
	color: white;
	display: flex;
	flex-direction: column;
	align-items: center;
	border-bottom-right-radius: 10px;
	justify-content: center;
}

.menu-option {
	font-family: 'Lato';
	font-size: 11pt;
	font-weight: bold;
	width: 100%;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	margin-bottom: 15px;

	input[type='button'] {
		font-family: 'Lato';
		font-size: 11pt;
		font-weight: bold;
		margin: 0;
		padding: 0;
		border: none;
		width: 100px;
		height: 20px;
		background: white;
		margin-left: -3px;
		-webkit-appearance: none;
		border-radius: 10px;
		cursor: pointer;
		box-shadow: 0 4px 0 0 rgba(0,0,0,0.2);
	}
	
	input[type='checkbox'] {
		margin-right: 15px;
		-webkit-appearance: none;
		cursor: pointer;

		&:after {
			content: '';
			background: white;
			position: absolute;
			width: 15px;
			height: 15px;
			transform: translate(-50%, -50%);
		}
	}

	input#minimize {
		
	}
	
	input[type='checkbox']:disabled {
		&:after {
			background: #b5b5b5;
		}
	}
	
	input[type='checkbox']:checked {
		&:after {
			background-image: url('https://upload.wikimedia.org/wikipedia/commons/archive/0/03/20080131204044%21Green_check.svg');
			background-size: 10px 10px;
			background-repeat: no-repeat;
			background-position: center;
		}
	}
}

#icons-wrapper {
	position: absolute;
	transform: translate(-50%, -50%);
	top: 50%;
	left: 50%;

	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	width: 500px;
	height: 500px;
	border-radius: 100%;
	overflow: hidden;
}

.icon {
	position: relative;
	background: #373f46;
	border-radius: 100%;
	transition: .5s;
	width: 400px;
	height: 400px;
	
	&:after {
		content: '';
		background: white;
		position: absolute;
		border-radius: 100%;
		opacity: 0.0;
		width: 100%;
		height: 100%;
	}
}
.icon.sunny {
	background: #90CAF9;
}
.icon.raining {
	background: #9cadbb;
}
.icon.main.lightning {
	&:after {
		animation: lightning 8s linear infinite;
	}
}

.sun {
	position: absolute;
	transform: translateX(-50%);
	left: -50%;
	top: 50px;
	background: #FFF176;
	height: 80px;
	width: 80px;
	border-radius: 100%;
	transition: .5s;
}
.sun.show {
	animation: sun-pop-in .4s ease-in-out .4s;
	animation-fill-mode: forwards;
}
.sun.hide {
	animation: sun-pop-out .4s ease-in-out;
	animation-fill-mode: forwards;	
}

.moon {
	position: absolute;
	transform: translateX(-50%);
	left: 150%;
	top: 50px;
	background: #E0E0E0;
	height: 80px;
	width: 80px;
	border-radius: 100%;
	transition: .5s;
}
.moon.start {
	left: 50%;
}
.moon.show {
	animation: moon-pop-in .4s ease-in-out .4s;
	animation-fill-mode: forwards;	
}
.moon.hide {
	animation: moon-pop-out .4s ease-in-out;
	animation-fill-mode: forwards;
}

.cloud {
	position: absolute;
	background: #FAFAFA;
	height: 60px;
	width: 60px;
	border-radius: 100%;
	transition: .5s;
	z-index: 10;

	&:after {
		content: '';
		background: #FAFAFA;
		position: absolute;
		border-radius: 100%;
		width: 60px;
		height: 60px;
		transform: translate(-40%, -45%);
		z-index: 10;
		transition: .5s;
	}
	&:before {
		content: '';
		background: #FAFAFA;
		position: absolute;
		border-radius: 100%;
		width: 60px;
		height: 60px;
		transform: translate(40%, 40%);
		z-index: 10;
		transition: .5s;
	}
}
.cloud.raining {
	background: #b5b5b5;
	&:after {
		background: #b5b5b5;
	}
	&:before {
		background: #b5b5b5;
	}
}
.cloud1 {
	transform: translateX(-50%);
	left: -50%;
	top: 50px;
}
.cloud1.show {
	left: 34%;
}
.cloud2 {
	transform: translateX(-50%);
	left: 150%;
	top: 100px;
}
.cloud2.show {
	left: 68%;
}

.bolt {
	position: absolute;
	left: -10px;
	top: 70px;
	z-index: 5;
	width: 80px;
	opacity: 0.0;
}
.bolt.one.show {
	animation: lightning 8s linear infinite;
}
.bolt.two.show {
	animation: lightning2 8s linear infinite;
}

.rain {
	margin-top: 52px;
	z-index: 0;
}
.rain.wind {
	animation: windyrain 4s infinite ease-out;
}

.drop {
	position: relative;
	float: left;
	width: 8px;
	margin: 10px;
	left: 20px;
	opacity: 0.0;
	background: #03A9F4;
}
.drop.rain {
	opacity: 1.0;
	animation: rain .8s infinite ease-out;
}

.drop:nth-child(1) {
	height: 15px;
	top: 5px;
	animation-delay: -1.0s;
}

.drop:nth-child(2) {
	height: 20px;
	top: 10px;
	animation-delay: -1.4s;
}

.drop:nth-child(3) {
	height: 15px;
	top: 10px;
	animation-delay: -1.6s;
}

.drop:nth-child(4) {
	height: 10px;
	top: 10px;
	animation-delay: -1.2s;
}

.drop:nth-child(5) {
	height: 5px;
	top: 15px;
	animation-delay: -1.6s;
}

.hill {
	position: absolute;
	left: 0;
	bottom: -50px;
	background: #475f48;
	height: 140px;
	width: 100%;
	border-radius: 100%;
	transition: .5s;
	z-index: 10;
}
.hill.sunny {
	background: #66BB6A;
}

.rainbow {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 100%;
	height: 100%;
	background: #E53935;
	opacity: 0.0;
	transition: 3s;
}
.rainbow.show {
	transition: 2s 2s;
	opacity: 0.5;
}

.rainbow div {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	border-radius: 100%;
}

.rainbow div:nth-child(1) {
	width: 96%;
	height: 96%;
	background: #FB8C00;
}
.rainbow div:nth-child(2) {
	width: 92%;
	height: 92%;
	background: #FFEB3B;
}
.rainbow div:nth-child(3) {
	width: 88%;
	height: 88%;
	background: #66BB6A;
}
.rainbow div:nth-child(4) {
	width: 84%;
	height: 84%;
	background: #039BE5;
}


@keyframes lightning {
    0%   	{opacity: 0.0;}
		9%  	{opacity: 0.0;}
    10%  	{opacity: 1.0;}
    20% 	{opacity: 0.0;}
    59%  	{opacity: 0.0;}
    60%  	{opacity: 1.0;}
    69% 	{opacity: 0.0;}
		70%  	{opacity: 1.0;}
		80% 	{opacity: 0.0;}
}

@keyframes lightning2 {
    0%   	{opacity: 0.0;}
		9%  	{opacity: 0.0;}
    10%  	{opacity: 0.0;}
    20% 	{opacity: 1.0;}
		30% 	{opacity: 0.0;}
    59%  	{opacity: 0.0;}
    60%  	{opacity: 0.0;}
    69% 	{opacity: 0.0;}
		70%  	{opacity: 1.0;}
		80% 	{opacity: 1.0;}
}

@keyframes rain {
	0% {
		opacity: 1;
		transform: translate(0, 0);
	}
	100% {
		opacity: 0.2;
		transform: translate(0, 400px);
	}
}

@keyframes windyrain {
	0% {
		transform: rotateZ(0deg);
	}
	10% {
		transform: rotateZ(10deg);
	}
	30% {
		transform: rotateZ(5deg);
	}
	40% {
		transform: rotateZ(25deg);
	}
	60% {
		transform: rotateZ(35deg);
	}
	70% {
		transform: rotateZ(20deg);
	}
	90% {
		transform: rotateZ(10deg);
	}
	100% {
		transform: rotateZ(0deg);
	}
}

@keyframes sun-pop-in {
	0% 		{ left: -50% }
	60% 	{ left: 65%; }
	100% 	{ left: 50%; }
}
@keyframes sun-pop-out {
	0% 		{ left: 50% }
	40% 	{ left: 65%; }
	100% 	{ left: -50%; }
}

@keyframes moon-pop-in {
	0% 		{ left: 150% }
	60% 	{ left: 35%; }
	100% 	{ left: 50%; }
}
@keyframes moon-pop-out {
	0% 		{ left: 50% }
	40% 	{ left: 35%; }
	100% 	{ left: 150%; }
}
            
          
!
            
              function daytime() {
	$(".sun").addClass('show');
	$(".sun").removeClass('hide');
	$(".moon").removeClass('show');
	$(".moon").addClass('hide');
	$(".moon").removeClass('start');
	$(".icon").addClass('sunny');
	$(".hill").addClass('sunny');

	if($(".drop").hasClass('rain')) {
		$(".icon").addClass('raining');
		showRainbow();
	}	
}
function nighttime() {
	$(".moon").addClass('show');
	$(".moon").removeClass('hide');
	$(".sun").removeClass('show');
	$(".sun").addClass('hide');
	$(".icon").removeClass('sunny');
	$(".icon").removeClass('raining');
	$(".hill").removeClass('sunny');
	
	hideRainbow();
}

function showClouds() {
	$(".cloud1").addClass('show');
	$(".cloud2").addClass('show');
	$("#rain").prop('disabled', false);	
	
	if($(".icon.main").hasClass('lightning')) {
		showBolts();
	}
}
function hideClouds() {
	$(".cloud1").removeClass('show');
	$(".cloud2").removeClass('show');
	$("#rain").prop('disabled', true);
	$("#rain").prop('checked', false);
	$("#wind").prop('disabled', true);	
	$("#wind").prop('checked', false);
	hideRain();
	hideWind();
	hideRainbow();
	hideBolts();
}

function showRain() {
	$(".drop").addClass('rain');
	$("#wind").prop('disabled', false);
	$(".cloud").addClass('raining');
	
	if($(".icon").hasClass("sunny")) {
		$(".icon").addClass('raining');
			showRainbow();
	}
}
function hideRain() {
	$(".drop").removeClass('rain');
	$(".icon").removeClass('raining');
	$(".cloud").removeClass('raining');
	$("#wind").prop('disabled', true);	
	$("#wind").prop('checked', false);
	hideRainbow();
	hideWind();
}

function showLightning() {
	$(".icon.main").addClass('lightning');
	
	if($(".cloud1").hasClass('show')) {
		showBolts();
	}
}
function hideLightning() {
	$(".icon").removeClass('lightning');
	hideBolts();
}

function showRainbow() {
	$(".rainbow").addClass('show');
}
function hideRainbow() {
	$(".rainbow").removeClass('show');
}

function showWind() {
	$(".rain").addClass('wind');
}
function hideWind() {
	$(".rain").removeClass('wind');
}

function showBolts() {
	$(".bolt").addClass('show');
}
function hideBolts() {
	$(".bolt").removeClass('show');
}

function storm() {
	showClouds();
	$("#clouds").prop('checked', true);
	showRain();
	$("#rain").prop('checked', true);
	showLightning();
	$("#lightning").prop('checked', true);
	showWind();
	$("#wind").prop('checked', true);
	showBolts();
}

$("#sun").click(function() {
	if($(this).is(':checked')) {
		daytime();
	}
	else {
		nighttime();
	}
});

$("#clouds").click(function() {
	if($(this).is(':checked')) {
		showClouds();
	}
	else {
		hideClouds();
	}
});

$("#rain").click(function() {
	if($(this).is(':checked')) {
		showRain();
	}
	else {
		hideRain();
	}
});

$("#lightning").click(function() {
	if($(this).is(':checked')) {
		showLightning();
	}
	else {
		hideLightning();
	}
});

$("#wind").click(function() {
	if($(this).is(':checked')) {
		showWind();
	}
	else {
		hideWind();
	}
});

$("#storm").click(function() {
	storm();
});
            
          
!
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.
Loading ..................

Console