Motion bouncing
+ ANIMATION :
+ Description :
This could be used to showcase a logo for instance with an entrance animation.
In order to achieve it you will find below the various codes to be used. Despite using Bricks builder, I tried to list up all the necessary steps to complete the animation to be the most universal as much as possible. Therefore I am close to what you will find in any IDE. For Bricks builder, please follow the HTML/CSS structure so you can add-up divs and give them CSS instead of putting it into the code block in order to avoid FOUC as the code block is loaded lastly within the page priority list.
For CSS, please note that I am considering that you are using a builder hence: no margin/padding reset has been applied and the font is not defined.
First let’s load GSAP and ScrollTrigger if necessary:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.3/gsap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.3/ScrollTrigger.min.js"></script>
HTML:
<div class="bouncing-section"> <div class="bouncing-ctn"> <img class="bouncing-img1 bouncing-img2" src="/Motion bouncing/agence-kokoro-k-192.svg" /> </div> </div>
CSS:
.bouncing-section { display: flex; align-items: center; justify-content: center; min-height: 75vh; width: 100%; background-color: #202020; } .bouncing-ctn { width: 300px; height: 300px; } .bouncing-img1 { transform: translateX(-500%) translateY(0%); } @media screen and (max-width: 767px) { .bouncing-ctn { width: 200px; height: 200px; } } @media screen and (max-width: 479px) { .bouncing-ctn { width: 120px; height: 120px; } }
JavaScript:
document.addEventListener("DOMContentLoaded", function (event) { //gsap.registerPlugin(ScrollTrigger); const mb = gsap.timeline({ scrollTrigger: { trigger: ".bouncing-ctn", start: "top bottom", toggleActions: "play reverse play reverse", }, }); mb.to(".bouncing-img1", { x: "0%", rotation: 1080, duration: 3.5, }); mb.to( ".bouncing-img2", { y: "-50%", repeat: 9, yoyo: true, duration: 0.3, ease: "sine.out", }, "<" ); });