GreenSock - Each Loop with tweens

Developer
Size
3,054 Kb
Views
30,360

How do I make an greensock - each loop with tweens?

GreenSock tweens inside of an each loop with a bit of randomness on timeline delay.Find out more GreenSock code snippets in the GreenSock Cheat Sheet. What is a greensock - each loop with tweens? How do you make a greensock - each loop with tweens? This script and codes were developed by Petr Tichy on 07 September 2022, Wednesday.

GreenSock - Each Loop with tweens Previews

GreenSock - Each Loop with tweens - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>GreenSock - Each Loop with tweens</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1><strong>Green<span>Sock</span></strong> - Each loop</h1>
<div id="box" class="box"> <div class="boxSmall"></div>
</div>
<div id="box2" class="box"> <div class="boxSmall"></div>
</div>
<div id="box3" class="box"> <div class="boxSmall"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.17.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

GreenSock - Each Loop with tweens - Script Codes CSS Codes

html, body { height: 100%;
}
body { background-color: #262626; font-family: 'Open Sans', sans-serif; overflow: hidden;
}
h1 { font-size: 16px; width: 300px; color: #838484; font-weight: 300; text-align: center; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -200px); transform: translate(-50%, -200px); padding: 10px 20px; border: 1px solid rgba(255, 255, 255, 0.3);
}
h1 span { color: #89c540;
}
h1 strong { color: #fff;
}
.box { background-color: #88ce02; position: absolute; top: 50%; left: 50%; width: 100px; height: 100px; -webkit-transform: translate(-155%, -50%); transform: translate(-155%, -50%); overflow: hidden;
}
#box2 { -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}
#box3 { -webkit-transform: translate(55%, -50%); transform: translate(55%, -50%);
}
.boxSmall { position: absolute; width: 50px; height: 50px; background-color: rgba(0, 0, 0, 0.3); z-index: 1; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}

GreenSock - Each Loop with tweens - Script Codes JS Codes

var $box = $('.box'), mainTl = new TimelineMax({repeat: -1, repeatDelay: 1});
$box.each(function(index, element){	var $boxSmall = $(this).find('.boxSmall'), $box = $(this), delay = getRandom(1, 1.7), boxTl = new TimelineMax({delay: delay});	// Add tweens to the box timeline	boxTl .from($box, 0.6, {autoAlpha: 0, y: '-=80', ease:Bounce.easeOut})	.fromTo($boxSmall, 1, {y:'-=80'}, {y: '0', ease:Bounce.easeOut}) .to($box, 1, {rotation: '45',ease:Power4.easeInOut}) .to($boxSmall, 1, {x: '0', ease:Bounce.easeOut}, '-=0.6') .to($box, 1, {rotation: '-45',ease:Power4.easeInOut}) .to($boxSmall, 1, {x: '-100%', ease:Bounce.easeOut}, '-=0.6') .to($boxSmall, 0.3, {scale: 2, transformOrigin: 'bottom left', autoAlpha: 0.5, ease:Power0.easeNone}) .to($box, 0.5, {rotation: 720, autoAlpha: 0, scale: 0.3,ease:Power4.easeIn}, '+=0.2'); mainTl.add(boxTl, '0');
});
function getRandom(min, max) { return min + Math.random() * (max - min);
}
GreenSock - Each Loop with tweens - Script Codes
GreenSock - Each Loop with tweens - Script Codes
Home Page Home
Developer Petr Tichy
Username ihatetomatoes
Uploaded September 07, 2022
Rating 3.5
Size 3,054 Kb
Views 30,360
Do you need developer help for GreenSock - Each Loop with tweens?

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!

Petr Tichy (ihatetomatoes) 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!