DEV Community

Cover image for Image Animation when Scrolling
Krisztián Maurer
Krisztián Maurer

Posted on • Updated on

Image Animation when Scrolling

Maurer Krisztián


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

I know, I know, it's not the best way to animate images, but it was a fun little project.

core code: animateImageByScroll.js

function animateImages(allImageNumber, startImageIndex, pixelChange, renderFunction)
Enter fullscreen mode Exit fullscreen mode


  • 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)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)