Home > Blockchain >  Keyframes not animating height
Keyframes not animating height

Time:12-09

the keyframes i created in my scss should be animating my height to make it a 2s animation but it has not done that instead the height is just transforming instantly but the width in the same keyframe is being animated.

@import url("https://fonts.googleapis.com/css2?family=Maven Pro:wght@500&family=Roboto&display=swap");
* {
  font-family: "Maven Pro", sans-serif;
  color: white;
  animation-delay: 1s;
}

body {
  width: 100%;
  height: 100vh;
  margin: 0%;
  background-color: green;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
  position: absolute;
  bottom: 5%;
}

.swipe {
  animation-name: swipeWidthHeight, close;
  animation-duration: 0.3s 2s;
  animation-delay: 1s, 10s;
  animation-fill-mode: forwards, forwards;
  display: flex;
  justify-content: center;
  height: 179px;
  width: 434px;
  background-color: #fff;
}

.swipe .side {
  width: 180px;
  height: 100%;
  background-color: #fff;
  display: flex;
  justify-content: center;
  animation-name: imageSize;
  animation-fill-mode: forwards;
  animation-duration: 0.3s;
}

.swipe .side img {
  width: 80%;
}

.swipe .center {
  position: relative;
  animation-name: centerExpand;
  animation-fill-mode: forwards;
  animation-duration: 0.3s;
  width: 74px;
  height: 100%;
  background-color: #38003c;
  display: flex;
  justify-content: center;
  align-items: center;
}

.swipe .center .popup.firstHalf {
  opacity: 0;
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
  width: 135px;
  height: 35px;
  background-color: white;
  color: #38003c;
  text-align: center;
  font-family: "roboto";
  font-size: 22px;
  line-height: 35px;
  font-weight: 500;
  animation-name: firstHalf;
  animation-delay: 2s;
  animation-duration: 3s;
  animation-fill-mode: forwards;
}

.swipe .center .popup.eaSports {
  opacity: 0;
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
  width: 110px;
  height: 76px;
  background-color: #38003c;
  color: #38003c;
  display: flex;
  align-items: center;
  justify-content: center;
  animation-name: firstHalf;
  animation-delay: 4.8s;
  animation-duration: 3s;
  animation-fill-mode: forwards;
}

.swipe .center .popup.eaSports img {
  width: 61px;
}

.swipe .center .textContainer {
  font-weight: 400;
  opacity: 0;
  margin: 0% 2% 0% 2%;
  height: 100%;
  width: 100%;
}

.swipe .center .textContainer.left {
  text-align: right;
  animation-delay: 1.15s;
  animation-name: leftText;
  animation-duration: 0.2s;
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.34, 0.58, 0.37, 1.48);
}

.swipe .center .textContainer.right {
  animation-name: rightText;
  animation-delay: 1.15s;
  animation-duration: 0.2s;
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.34, 0.58, 0.37, 1.48);
}

.swipe .center img {
  width: 44px;
}

@keyframes swipeWidthHeight {
  0% {
    height: 179px;
    width: 434px;
  }
  100% {
    height: 77px;
    width: 1064px;
  }
}

@keyframes centerExpand {
  90% {
    justify-content: space-between;
  }
  100% {
    width: 1020px;
    justify-content: space-between;
  }
}

@keyframes rightText {
  0% {
    opacity: 1;
  }
  100% {
    padding-left: 10%;
    opacity: 1;
  }
}

@keyframes leftText {
  0% {
    opacity: 1;
  }
  100% {
    padding-right: 10%;
    opacity: 1;
  }
}

@keyframes imageSize {
  100% {
    height: 77px;
    width: 77px;
  }
}

@keyframes firstHalf {
  0% {
    opacity: 1;
    bottom: 0%;
    z-index: -1;
  }
  10% {
    z-index: -1;
    opacity: 1;
    bottom: 100%;
  }
  90% {
    z-index: -1;
    opacity: 1;
    bottom: 100%;
  }
  99% {
    z-index: -1;
    opacity: 1;
    bottom: 0%;
  }
  100% {
    z-index: -1;
    opacity: 0;
    bottom: 0%;
  }
}

@keyframes close {
  100% {
    width: 1064px;
    height: 77px;
    bottom: -20%;
  }
}
<body>
  <div >
    <div >
      <img src="https://cdn.discordapp.com/attachments/868038988437536768/918357217772732446/crest.svg" alt="">
    </div>
    <div >
      <div >First Half</div>
      <div >
        <img src="https://cdn.discordapp.com/attachments/868038988437536768/918357218003415080/ea-sports-logo.png" alt="">
      </div>
      <div >
        <h1 >MANCHESTER CITY</h1>
      </div>
      <img src="https://cdn.discordapp.com/attachments/868038988437536768/918357218208907274/premier-league-icon.png" alt="">
      <div >
        <h1 >MANCHESTER CITY</h1>
      </div>
    </div>
    <div >
      <img src="https://cdn.discordapp.com/attachments/868038988437536768/918357217772732446/crest.svg" alt="">
    </div>
  </div>
</body>

In the codepen the class "swipe" and key frame of 'swipeWidthHeight'is the element thats is having issues with the height not animating.

here is a codepen below if the whole project for a better understanding https://codepen.io/charlieschuyler/pen/zYBZzZv

CodePudding user response:

Comma Missing:

.swipe {
  animation-name: swipeWidthHeight, close;
  animation-duration: 0.3s, 2s; /* missing comma */
  animation-delay: 1s, 10s;
  animation-fill-mode: forwards, forwards;
  display: flex;
  justify-content: center;
  height: 179px;
  width: 434px;
  background-color: #fff;
}
  • Related