Skip to content

About

✨ CSS Image Split Animation — HTML/CSS/JS creative UI project.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSS Image Split Animation

Live Demo HTML CSS JavaScript License: MIT

A responsive, runnable recreation of the uploaded 13.7-second screen recording.

What the video shows

  • Heading: CSS Image Split Animation
  • A landscape photo displayed inside a rounded rectangular image card
  • The photo is split into two vertical halves
  • Hovering the card slides the left half to the left and the right half to the right
  • The center reveals a black panel with EXPLORE / The Hidden Details and a small decorative mark

CSS declarations readable in the recording

The video visibly shows these source settings and rules:

:root {
  --anim-speed: 0.6s;
  --anim-curve: cubic-bezier(0.25, 1, 0.5, 1);
  --split-distance: 60%;
  --img-url: url('https://picsum.photos/id/1067/800/500');
}

body { scale: 0.8; }

.split-container {
  position: relative;
  width: 470px;
  height: 325px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  background: #111;
}

.reveal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #fff;
  z-index: 1;
  font-family: 'Arial Black', sans-serif;
  letter-spacing: 4px;
}

.split-half {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-image: var(--img-url);
  background-size: 1200px 400px;
  background-repeat: no-repeat;
  z-index: 2;
  transition: transform var(--anim-speed) var(--anim-curve);
}

.split-half.left {
  left: 0;
  background-position: left center;
  transform-origin: left center;
}

.split-half.right {
  right: 0;
  background-position: right center;
  transform-origin: right center;
}

.split-container:hover .split-half.left {
  transform: translateX(calc(-1 * var(--split-distance)));
}

.split-container:hover .split-half.right {
  transform: translateX(var(--split-distance));
}

Some source lines are too small or partially clipped in the screen recording. The runnable CSS keeps the same structure and interaction, but uses a responsive background sizing rule so both halves remain aligned at different viewport widths.

Run locally

  1. Extract the ZIP.
  2. Open index.html in a modern browser.
  3. Hover the image on desktop or tap it on a touch device.

No build tools or packages are needed. The photo URL is remote, so internet access is needed to load that image. Replace --img-url in style.css with a local image URL if desired.

Files

  • index.html — markup
  • style.css — split-image effect and responsive styling
  • script.js — touch-friendly click interaction
  • README.md — extracted visible CSS and setup notes

Source fidelity

The uploaded video is a screen recording of an editor and live preview, not the original project repository. Readable CSS declarations have been transcribed in the README. Parts that are cut off or illegible have been reconstructed; this is not byte-for-byte recovery of the unseen original files.

👨‍💻 Author

mrchandrayee · GitHub

📄 License

MIT License

About

✨ CSS Image Split Animation — HTML/CSS/JS creative UI project.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages