Winter Scene
How do I make an winter scene?
Simple animation using some unicode characters.... What is a winter scene? How do you make a winter scene? This script and codes were developed by Jeff Daze on 18 January 2023, Wednesday.
Winter Scene - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Winter Scene</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="body-wrapper"> <div class="wrapper"> <!-- <div class="snowflake sn1">❄</div> <div class="snowflake">❅</div> <div class="snowflake">❆</div> --> <div class="snowman">☃</div> <button id="run">run</button> <button id="stop">stop</button> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Winter Scene - Script Codes CSS Codes
.snowflake{ font-size:84px; color:#FFF; position:absolute; left: 200px; top:10px;
}
.snowman{ position:absolute; bottom:1px; width:100%; text-align:center; font-size:200px; color:#FFF;
}
.wrapper { min-height: 100%; height: auto !important; height: 100%; background: #1E5799; /* old browsers */ background: -moz-linear-gradient(top, #002c5a 0%, #EAEAEA 100%); /* firefox */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#002c5a), color-stop(100%,#EAEAEA)); /* webkit */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#002c5a', endColorstr='#EAEAEA',GradientType=0 ); /* ie */
}
.body-wrapper { height: 1000px; width: 100%;
}
Winter Scene - Script Codes JS Codes
var degree = 0;
var runner;
$("#run").click(function(){ runner = setInterval(run, 800);
});
$("#stop").click(function(){ clearInterval(runner);
});
function run(){ // $( ".sn1" ).animate({ "top": "+=50px", "left": "+=20px" }).animate({ "top": "+=50px", "left": "-=20px" }); var newElem = $('<div class="snowflake" />').html(randFlake()).appendTo($(document.body)).css({"left": randVal($( window ).width())+"px", "fontSize": randVal(30, 5)+"px"}); var start = null;
function step(timestamp) { var progress; if (start === null) start = timestamp; progress = timestamp - start; randMove(newElem); if (progress < 2500) { requestAnimationFrame(step); }
}
requestAnimationFrame(step);
}
//3 different kinds of flake glyph...
function randFlake(){ var glyphs = ["❄","❅","❆"]; return glyphs[randVal(glyphs.length)];
}
function randMove(element){ var jitter = randVal(4); var coin = randVal(3); //flip a coin! if(coin == 1){ //$(element).animate({"top": "+=100px", "left": "+="+jitter+"px"}); $(element).css({"top": "+=5px", "left": "+="+jitter+"px"}); }else if(coin == 2){ //$(element).animate({"top": "+=100px", "left": "-="+jitter+"px"}); $(element).css({"top": "+=5px", "left": "-="+jitter+"px"}); }else{ $(element).css({"top": "+=5px"}); } //rotate... degree = degree + 1; $(element).css({'-webkit-transform': 'rotate(' + degree + 'deg)', '-moz-transform': 'rotate(' + degree + 'deg)', '-ms-transform': 'rotate(' + degree + 'deg)', '-o-transform': 'rotate(' + degree + 'deg)', 'transform': 'rotate(' + degree + 'deg)'});
}
function randVal(val, offset){ //set a default value of 0 for offset... offset = typeof offset !== 'undefined' ? offset : 0; return Math.floor(Math.random() * val)+offset;
}

Developer | Jeff Daze |
Username | jeffdaze |
Uploaded | January 18, 2023 |
Rating | 3 |
Size | 2,739 Kb |
Views | 4,046 |
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 |
Quick torus demo three.js | 1,894 Kb |
Simple handlebars demo | 1,940 Kb |
Desktop Notifications | 1,975 Kb |
Finite Scroll Example | 3,082 Kb |
Pulsing Button | 1,659 Kb |
A test card for a Munchkin-like game | 2,044 Kb |
Starfield using KineticJS | 3,290 Kb |
Simulation of famous C64 code... | 1,788 Kb |
Tilemap Edge CSS | 2,159 Kb |
Circular Drag and Drop | 2,451 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 |
Tic Tac Toe | Volv | 4,862 Kb |
Banner Ad | Raquellorenzana | 4,172 Kb |
Segments mouse following | Nosir | 2,909 Kb |
Sassy Buttons | Elyseholladay | 2,299 Kb |
Gradients | Karpovsystems | 2,394 Kb |
Weather App | Kw7oe | 3,162 Kb |
A simple log in form made with css | Mayurelbhar | 2,160 Kb |
Whyutils | LeYvan | 3,752 Kb |
Drag n Drop | Martin42 | 2,594 Kb |
Highbrow Basic HTML Lesson 7 | Kimlarocca | 1,662 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!