Code Monkey home page Code Monkey logo

scrolling-ball's Introduction

Bouncing Ball Animation with GSAP README

This is a JavaScript animation project that uses the GreenSock Animation Platform (GSAP) to create a captivating bouncing ball animation on an HTML canvas. The animation includes a sequence of images that make up the bouncing ball and text elements that appear and disappear as you scroll down the page.

Table of Contents

Prerequisites

To run this animation project, you need a modern web browser that supports HTML5, CSS3, and JavaScript.

Setup

  1. Clone this repository or download the code to your local machine.

  2. Open the index.html file in your web browser. The animation will start automatically when the page loads.

Usage

  • As you scroll down the page, you'll witness a captivating animation of a bouncing ball.
  • Text elements will appear and fade away at specific scroll positions, creating an engaging visual experience.
  • You can customize the animation's behavior by adjusting the GSAP scroll triggers and animation settings in the JavaScript code.

Project Structure

The project directory structure is as follows:

  • index.html: The main HTML file that displays the canvas and animations.
  • styles.css: The CSS file used for styling the HTML elements on the page.
  • script.js: The JavaScript file that manages the animation and GSAP scroll triggers.
  • best-ball/: This directory contains a sequence of images (.jpg) used to create the bouncing ball animation. The images should be stored in this directory.

How It Works

  • The JavaScript code loads a sequence of images from the best-ball/ directory and stores them in an array. Each image represents a different frame of the bouncing ball animation.

  • GSAP (GreenSock Animation Platform) is used to control the animation. GSAP provides powerful tools for creating smooth and interactive animations.

  • The gsap.to function animates the ball's position based on the scroll position, using the "scrub" property to synchronize the animation with scrolling. It also pins the canvas to the screen and sets the animation's end point.

  • The gsap.fromTo function animates the opacity of text elements, making them appear and disappear at specific scroll positions.

  • The render function updates the canvas with the current frame of the animation, creating the illusion of a bouncing ball.

Credits

This animation project was created using the GreenSock Animation Platform (GSAP) and Blender. For more information about GSAP and its features, please visit the GSAP website.

Blender

Issue

This website experiences slow loading times due to the large number of images that load as you scroll. The site's functionality involves replacing the current image with the next one as you scroll, and there are a total of 180 images. If anyone has a solution to address this issue, please feel free to share it.

Enjoy exploring and customizing this animation project to suit your needs!

scrolling-ball's People

Contributors

piyushbaibhav avatar

Stargazers

BK7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.