Simple Night Sky
How do I make an simple night sky?
Simple moon and stars with CSS. All stars are generated randomly each time with a little JS help.. What is a simple night sky? How do you make a simple night sky? This script and codes were developed by Assaf Gelber on 03 January 2023, Tuesday.
Simple Night Sky - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple Night Sky</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ html,
body { width: 100%; height: 100%; margin: 0; padding: 0; background: #15294e; overflow: hidden;
}
.moon { position: absolute; top: 10%; right: 25%; width: 200px; height: 200px; border-radius: 50%; background: #ddd; box-shadow: inset 20px -10px 0 0 #b9b9b9;
}
.moon .crater1 { position: absolute; width: 60px; height: 60px; border-radius: 50%; background: #bbb; box-shadow: inset -6px 3px 0 0 #aaa; top: 30px; right: 30px;
}
.moon .crater2 { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #bbb; box-shadow: inset -2px 1px 0 0 #aaa; top: 80px; right: 100px;
}
.moon .crater3 { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: #bbb; box-shadow: inset -3px 1.5px 0 0 #aaa; top: 110px; right: 60px;
}
.stars { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
}
.stars .star { position: absolute; background: #f8f4a2; border-radius: 50%;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class='stars js-plaxify' data-xrange='60' data-yrange='60'></div>
<div class='moon js-plaxify' data-xrange='20' data-yrange='20'> <div class='crater1'></div> <div class='crater2'></div> <div class='crater3'></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdn.rawgit.com/cameronmcefee/plax/master/js/plax.js'></script> <script src="js/index.js"></script>
</body>
</html>
Simple Night Sky - Script Codes CSS Codes
html,
body { width: 100%; height: 100%; margin: 0; padding: 0; background: #15294e; overflow: hidden;
}
.moon { position: absolute; top: 10%; right: 25%; width: 200px; height: 200px; border-radius: 50%; background: #ddd; box-shadow: inset 20px -10px 0 0 #b9b9b9;
}
.moon .crater1 { position: absolute; width: 60px; height: 60px; border-radius: 50%; background: #bbb; box-shadow: inset -6px 3px 0 0 #aaa; top: 30px; right: 30px;
}
.moon .crater2 { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #bbb; box-shadow: inset -2px 1px 0 0 #aaa; top: 80px; right: 100px;
}
.moon .crater3 { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: #bbb; box-shadow: inset -3px 1.5px 0 0 #aaa; top: 110px; right: 60px;
}
.stars { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
}
.stars .star { position: absolute; background: #f8f4a2; border-radius: 50%;
}
Simple Night Sky - Script Codes JS Codes
var $sky = $(".stars");
var skyHeight = $sky.innerHeight(), skyWidth = $sky.innerWidth(); numberOfStars = (skyWidth * skyHeight) / 10000;
for (var i = 0; i < numberOfStars; i++) { var starSize = Math.floor((Math.random() * 8) + 2), starTop = Math.floor(Math.random() * skyHeight), starLeft = Math.floor(Math.random() * skyWidth); $('<div class="star">').css({ width: starSize, height: starSize, top: starTop, left: starLeft }).prependTo($sky);
}
$(".js-plaxify").plaxify();
$.plax.enable();
Developer | Assaf Gelber |
Username | agelber |
Uploaded | January 03, 2023 |
Rating | 4 |
Size | 3,266 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Posting Animation | 4,524 Kb |
Origin Demo | 3,523 Kb |
Translate Demo | 3,188 Kb |
Perspective Demo | 3,143 Kb |
Form Placeholder Labels | 3,824 Kb |
Social Link Handle Animation | 3,241 Kb |
Blurring Menu | 2,934 Kb |
Pure CSS Image Gallery | 3,911 Kb |
Animation Demo | 3,031 Kb |
ScaleZ Demo | 3,184 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Subscription Newsletter - Before inlining | Bradstrong | 7,526 Kb |
Loading... | Adamjacob | 2,384 Kb |
SVG Icons Template | Legofsalmon | 2,618 Kb |
Simple search using AngularJS | Haykou | 1,802 Kb |
CSS3 Diamond | Rendro | 1,960 Kb |
Clock Face Idea | Chrisburnell | 3,196 Kb |
GLSL Hills | Ykob | 6,991 Kb |
3d css cube | Semenchenko | 4,578 Kb |
Save for later... | Victorfreire | 1,359 Kb |
Button shaking | SusanneLundblad | 2,227 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!