HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-
scale=1.0" />
<link rel="stylesheet" href="[Link]" />
<title>3D Product Card</title>
</head>
<body>
<div class="container">
<div class="card">
<div class="sneaker">
<div class="circle"></div>
<img src="[Link]" alt="adidas" style="border-radius:
50%; height: 250px; width: 250px;" />
</div>
<div class="info">
<h1 class="title">Adidas ZX</h1>
<h3>
FUTURE-READY TRAINERS WITH WRAPPED BOOST
FOR EXCEPTION COMFORT.
</h3>
<div class="sizes">
<button>39</button>
<button>40</button>
<button class="active">42</button>
<button>44</button>
</div>
<div class="purchase">
<button>Purchase</button>
</div>
</div>
</div>
</div>
<script src="[Link]"></script>
</body>
</html>
css
@import url("[Link]
family=Poppins:wght@400;500&display=swap");
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Poppins", sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
overflow: hidden;
perspective: 1000px;
}
.container {
width: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.card {
min-height: 80vh;
width: 25rem;
box-shadow: 0px 20px 20px rgba(0, 0, 0, 0.2), 0px
0px 50px rgba(0, 0, 0, 0.2);
border-radius: 30px;
padding: 0rem 2rem;
transform-style: preserve-3d;
}
.sneaker {
min-height: 35vh;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.sneaker img {
width: 13rem;
z-index: 2;
transition: all 0.75s ease-out;
}
.circle {
width: 7rem;
height: 7rem;
background: linear-gradient(
to right,
rgba(245, 70, 66, 0.75),
rgba(8, 83, 156, 0.75)
);
position: absolute;
z-index: -1;
border-radius: 50%;
}
.info h1 {
font-size: 1.7rem;
transition: all 0.75s ease-out;
}
.info h3 {
font-size: 1rem;
padding: 2rem 0rem;
color: #585858;
font-weight: lighter;
transition: all 0.75s ease-out;
}
.sizes {
display: flex;
justify-content: space-between;
transition: all 0.75s ease-out;
}
.sizes button {
padding: 0.5rem 2rem;
background: none;
border: none;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
border-radius: 30px;
cursor: pointer;
font-weight: bold;
font-family: inherit;
color: #585858;
}
[Link] {
color: white;
background-color: rgb(231, 112, 112);
}
.purchase {
margin-top: 3rem;
transition: all 0.75s ease-out;
}
.purchase button {
width: 100%;
padding: 1rem 0rem;
background: rgb(114, 114, 243);
border: none;
color: white;
cursor: pointer;
border-radius: 30px;
font-weight: bolder;
font-family: inherit;
}
@media screen and (min-width: 740px) {
.card {
width: 35rem;
padding: 0rem 5rem;
}
.sneaker img {
width: 20rem;
}
.circle {
width: 15rem;
height: 15rem;
}
.info h1 {
font-size: 3rem;
}
.info h3 {
font-size: 1.3rem;
}
}
JAVSCRIPT
// Movement Animation to happen
const card = [Link](".card");
const container = [Link](".container");
// Items
const title = [Link](".title");
const sneaker = [Link](".sneaker img");
const purchase = [Link](".purchase");
const description = [Link](".info h3");
const sizes = [Link](".sizes");
// Moving animation event
[Link]("mousemove", (e) => {
let xAxis = ([Link] / 2 - [Link]) / 25;
let yAxis = ([Link] / 2 - [Link]) / 25;
[Link] = `rotateX(${yAxis}deg)
rotateY(${xAxis}deg)`;
});
// Animate In
[Link]("mouseenter", (e) => {
[Link] = "none";
// Popout
[Link] = "translateZ(150px)";
[Link] = "translateZ(200px) rotateZ(-45deg)";
[Link] = "translateZ(125px)";
[Link] = "translateZ(100px)";
[Link] = "translateZ(75px)";
});
// Animate Out
[Link]("mouseleave", (e) => {
[Link] = "all 0.5s ease";
[Link] = `rotateX(0deg) rotateY(0deg)`;
//Popback
[Link] = "translateZ(0px)";
[Link] = "translateZ(0) rotateZ(0deg)";
[Link] = "translateZ(0px)";
[Link] = "translateZ(0px)";
[Link] = "translateZ(0px)";
});