Tears Of Happiness

Developer
Size
3,667 Kb
Views
20,240

How do I make an tears of happiness?

A CSS3 animation events with dynamic element creation experiment. The speed sets the density, and CSS filters support the depth.. What is a tears of happiness? How do you make a tears of happiness? This script and codes were developed by Yogev Ahuvia on 11 September 2022, Sunday.

Tears Of Happiness Previews

Tears Of Happiness - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Tears Of Happiness</title> <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! */ .stream { width: 100%; margin: 0 auto; position: relative;
}
.tear { position: absolute; top: -50px; width: 20px; height: 20px; border-radius: 50%; animation: pour 5s ease-in; -webkit-filter: blur(0px); filter: blur(0px);
}
.far { width: 17px; height: 17px; animation-duration: 5s; -webkit-filter: blur(1px);
}
.furthest { width: 14px; height: 14px; animation-duration: 7s; -webkit-filter: blur(2px);
}
label { font-family: sans-serif; font-size: 12px;
}
input[type='range'] { border-radius: 5px; background: #ccc; height: 8px; -moz-appearance: none; -webkit-appearance: none;
}
input[type='range']::-webkit-slider-thumb { cursor: pointer; border-radius: 100%; background: #eee; height: 15px; width: 15px; -moz-appearance: none; -webkit-appearance: none; -moz-box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white; -webkit-box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white; box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white;
}
@keyframes pour { from { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); transform: translateY(0px); } to { -moz-transform: translateY(1080px); -ms-transform: translateY(1080px); -webkit-transform: translateY(1080px); transform: translateY(1080px); }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="controls"> <label for="density">less</label> <input type="range" id="density" min="1" max="1001" step="10" value="901"> <label for="density">more</label>
</div>
<div class="stream"></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>

Tears Of Happiness - Script Codes CSS Codes

.stream { width: 100%; margin: 0 auto; position: relative;
}
.tear { position: absolute; top: -50px; width: 20px; height: 20px; border-radius: 50%; animation: pour 5s ease-in; -webkit-filter: blur(0px); filter: blur(0px);
}
.far { width: 17px; height: 17px; animation-duration: 5s; -webkit-filter: blur(1px);
}
.furthest { width: 14px; height: 14px; animation-duration: 7s; -webkit-filter: blur(2px);
}
label { font-family: sans-serif; font-size: 12px;
}
input[type='range'] { border-radius: 5px; background: #ccc; height: 8px; -moz-appearance: none; -webkit-appearance: none;
}
input[type='range']::-webkit-slider-thumb { cursor: pointer; border-radius: 100%; background: #eee; height: 15px; width: 15px; -moz-appearance: none; -webkit-appearance: none; -moz-box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white; -webkit-box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white; box-shadow: 0px 0px 1px 1px #999, inset 0px 1px 1px 1px white;
}
@keyframes pour { from { -moz-transform: translateY(0px); -ms-transform: translateY(0px); -webkit-transform: translateY(0px); transform: translateY(0px); } to { -moz-transform: translateY(1080px); -ms-transform: translateY(1080px); -webkit-transform: translateY(1080px); transform: translateY(1080px); }
}

Tears Of Happiness - Script Codes JS Codes

var density; updateDensity();
$('#density').on('change', updateDensity);
setTimeout(pour, density);
function pour() { var speed = randomSpeed(); var color = randomColor(); var offset = randomOffset(); var tear = $('<div class="tear '+speed+'" style="background: '+color+'; left: '+offset+'px;"></div>'); $('.stream').append(tear); $(tear).on('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(e) { $(this).remove(); }); setTimeout(pour, density);
}
function updateDensity() { density = $('#density').attr('max') - $('#density').val();
}
function randomSpeed() { var choice = Math.round(Math.random() * 3); return (choice == 0 ? "" : (choice == 1 ? "far" : "furthest"));
}
function randomColor() { // http://stackoverflow.com/a/1484514 var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++ ) { color += letters[Math.round(Math.random() * 15)]; } return color;
}
function randomOffset() { return Math.round(Math.random() * $('.stream').width());
}
Tears Of Happiness - Script Codes
Tears Of Happiness - Script Codes
Home Page Home
Developer Yogev Ahuvia
Username kindofone
Uploaded September 11, 2022
Rating 3
Size 3,667 Kb
Views 20,240
Do you need developer help for Tears Of Happiness?

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!

Yogev Ahuvia (kindofone) Script Codes
Create amazing sales emails with AI!

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!