Image Animation when Scrolling

Image Animation when Scrolling

Scroll_Image_Animation.gif

Code: https://github.com/MaurerKrisztian/Scroll_Image_Animation

Demo: https://maurerkrisztian.github.io/Scroll_Image_Animation/

This project is about making animation with pictures by scrolling up and down and looping them.

core code: animateImageByScroll.js

window.onscroll = function () {
  animateImages(24, 10, 25, renderImage)
};
function animateImages(allImageNumber, startImageIndex, pixelChange, renderFunction)

animateImages:

  • allImageNumber: number of all pictures
  • startImageIndex: the initial numbering of the images (now it's 10. m-10.png)
  • pixelChange: animation speed.
  • renderFunction: this function will get the actual image number and it will render to the screen
function renderImage(ImageNumber)