GIF


Uncategorized

Updated Dec 12th, 2021

Giphy.com, search. Click on the one you like. Right click, save as. Convert format to mp4 (I used this site here) and then save into project and link in JSX with “video” tag. Done.

Here’s an example of conditionally showing different images whether a quiz is passed or failed. If the user passes it randomly selects a source from an array of paths.

<video autoPlay loop playsInline>
  <source src={percentage <= 70 ? "fail-pigs.mp4" : pass[Math.floor(Math.random() * pass.length)]} />
</video>