Skip to content

Commit 4d340ca

Browse files
author
Greg Pfaff
committed
adding animations
1 parent cf95d8d commit 4d340ca

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Carousel/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ const activeCards = (event) => {
1010
card.style.zIndex = "1"
1111
card.classList.add('active');
1212
card.setAttribute('aria-selected', 'true');
13+
const random = Math.random() * 100 - 50;
14+
card.style.transform = `rotate(${random}deg) scale(1.25)`
1315
} else {
1416
card.style.zIndex = "0"
1517
card.classList.remove('active');
1618
card.setAttribute('aria-selected', 'false');
19+
card.style.transform = 'rotate(0deg) scale(1)';
1720
}
1821
})
1922
}

Carousel/style.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ h1 {
2727
right: 0;
2828
top: 100px;
2929
margin-left: -125px;
30+
transition-duration: 200ms;
31+
transition-timing-function: cubic-bezier(0, 0, 0, 0);
32+
3033
}
3134

3235
.card_pagination {
@@ -44,6 +47,13 @@ h1 {
4447
background-color: black;
4548
}
4649

50+
.card.active {
51+
transition-duration: 200ms;
52+
transition-timing-function: cubic-bezier(.17, .67, .92, .3);
53+
}
54+
55+
56+
4757
.card.one {
4858
left: 60%;
4959
right: 0;

0 commit comments

Comments
 (0)