Random

Size
3,604 Kb
Views
20,240

How do I make an random?

The power of jQuery animate plus rand(a,b). Also some css animations and transitions. It's pretty funny.. What is a random? How do you make a random? This script and codes were developed by Alejandro Montañez on 13 October 2022, Thursday.

Random Previews

Random - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Random</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>random</h1>
<div class='element'> <div class='one'></div> <div class='two'></div>
</div>
<div class='element'> <div class='one'></div> <div class='two'></div>
</div>
<div class='element'> <div class='one'></div> <div class='two'></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>

Random - Script Codes CSS Codes

/* Say hello: @codeams * Inspiration: https://goo.gl/63zkRG * Random color script: https://goo.gl/TsMnIz */
html, body { width: 100%; height: 100%; overflow: hidden;
}
body { margin: 0; background: #30252E; color: #f60;
}
h1 { display: table; position: relative; top: calc(50% - 66px); z-index: 2; margin: 0 auto; padding: 10px 20px; border-radius: 40px; text-align: center; letter-spacing: 5px; font: 300 112px/1 "Open Sans Condensed", sans-serif; background: rgba(20, 15, 19, 0.7);
}
.element { width: 200px; height: 200px; position: absolute; top: calc(50% - 100px); left: calc(50% - 100px); z-index: 1; -webkit-animation-delay: 5s; animation-delay: 5s; -webkit-animation-name: rotateleft; animation-name: rotateleft; -webkit-animation-duration: 4s; animation-duration: 4s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-direction: alternate; animation-direction: alternate;
}
.element .one, .element .two { width: 100%; height: 100%; position: absolute; border-size: 2px; border-style: solid; border-color: transparent; border-radius: 50%; -webkit-transition-property: border-color; transition-property: border-color; -webkit-transition-duration: 300ms; transition-duration: 300ms; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-direction: alternate; animation-direction: alternate;
}
.element .one { z-index: 1; -webkit-animation-delay: 200ms; animation-delay: 200ms; -webkit-animation-name: rotateleft; animation-name: rotateleft; -webkit-animation-duration: 3s; animation-duration: 3s;
}
.element .two { z-index: 2; -webkit-animation-delay: 0ms; animation-delay: 0ms; -webkit-animation-name: rotateright; animation-name: rotateright; -webkit-animation-duration: 2s; animation-duration: 2s;
}
@-webkit-keyframes rotateleft { 50% { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } 100% { -webkit-transform: rotate(-135deg); transform: rotate(-135deg); }
}
@keyframes rotateleft { 50% { -webkit-transform: rotate(-90deg); transform: rotate(-90deg); } 100% { -webkit-transform: rotate(-135deg); transform: rotate(-135deg); }
}
@-webkit-keyframes rotateright { 50% { -webkit-transform: rotate(45deg); transform: rotate(45deg); } 100% { -webkit-transform: rotate(90deg); transform: rotate(90deg); }
}
@keyframes rotateright { 50% { -webkit-transform: rotate(45deg); transform: rotate(45deg); } 100% { -webkit-transform: rotate(90deg); transform: rotate(90deg); }
}

Random - Script Codes JS Codes

var body = $('body')
function rand(a, b){return Math.round( Math.random() * (b - a) + a
)}
function randColor(){ var red = rand(0,255), green = rand(0,255), blue = rand(0,255) return 'rgb('+ red +','+ green +','+ blue +')'
}
setInterval(function(){ $('.element').each(function(i){ i++ var squares = { 'border-radius': rand(0,50) + '%', width : rand(100,250) + 'px', height: rand(100,250) + 'px' }, element = { top : (rand(20,80) - (5000 / body.height())) + '%', left : (rand(20,80) - (5000 / body.width())) + '%' } $(this).animate(element, rand(1000,5000)) // .element .children('.one') .animate(squares, rand(800,900)) .css({'border-color' : randColor()}) .siblings('.two') .animate(squares, rand(800,900)) .css({'border-color' : randColor()}) })
}, 1000)
Random - Script Codes
Random - Script Codes
Home Page Home
Developer Alejandro Montañez
Username codeams
Uploaded October 13, 2022
Rating 3.5
Size 3,604 Kb
Views 20,240
Do you need developer help for Random?

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!

Alejandro Montañez (codeams) Script Codes
Create amazing Facebook ads 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!