Offset animation

I am trying to animate a divider that slides up a view using animation courtesy of Animate.css , specifically using the fadeInUp animation.

However, the divisor doesn't really "slip" into account as much once it disappears. You can see a visualization of this in this JSFiddle .

Is there some way to compensate for the animation of the divider so that it starts at the bottom and actually slides up, rather than just fading out at a specific location?

HTML:

<h1 class="animated fadeInUp">Text text text</h1>
<div class="divider animated fadeInUp"></div>

      

CSS

h1 {
  text-align: center;
}

.divider {
  background-color: #808082;
  height: 2px;
  width: 80px;
  margin: 30px auto;
  -webkit-animation-delay: .5s;
  animation-delay: .5s;
}

.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

@-webkit-keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
            transform: translate3d(0, 100%, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: none;
     transform: none;
  }
}

.fadeInUp {
  -webkit-animation-name: fadeInUp;
   animation-name: fadeInUp;
}

      

+3


source to share


3 answers


another way is to use an element :pseudo

:after

to add a separator

demo - http://jsfiddle.net/victor_007/tq2qpgyp/4/

h1:after {
    content:'';
    background-color: #808082;
    height: 2px;
    width: 80px;
    display:block;
    margin: 30px auto;
}

      



h1 {
  text-align: center;
}
h1:after {
  content: '';
  background-color: #808082;
  height: 2px;
  width: 80px;
  display: block;
  margin: 30px auto;
}
.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
@-webkit-keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}
@keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}
.fadeInUp {
  -webkit-animation-name: fadeInUp;
  animation-name: fadeInUp;
}
      

<h1 class="animated fadeInUp">Text text text</h1>
      

Run codeHide result


+1


source


One way: add a border to the separator

Updated violin

.divider {
  background-color: #808082;
  height: 2px;
  width: 80px;
  margin: 10px auto 30px;
  -webkit-animation-delay: .5s;
  animation-delay: .5s;
  border-top: 20px solid white; /* <--- added */
}

      



h1 {
  text-align: center;
}
.divider {
  background-color: #808082;
  height: 2px;
  width: 80px;
  margin: 10px auto 30px;
  -webkit-animation-delay: .5s;
  animation-delay: .5s;
  border-top: 20px solid white;
}
.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}
@-webkit-keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}
@keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
  100% {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}
.fadeInUp {
  -webkit-animation-name: fadeInUp;
  animation-name: fadeInUp;
}
      

<h1 class="animated fadeInUp">Text text text</h1>
<div class="divider animated fadeInUp"></div>
      

Run codeHide result


0


source


Try using a :after

css property like this.

You can write anything in content:'';

This is a special library

h1 {
    display:inline-block;
    position:relative;
}

h1:after{
    content:'\2014\2014\2014';
    position:absolute;
    bottom:-25px;
    left:50px;
    word-spacing: 30px;
    
}

.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

@-webkit-keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
            transform: translate3d(0, 100%, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: none;
            transform: none;
  }
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
            transform: translate3d(0, 100%, 0);
  }

  100% {
    opacity: 1;
    -webkit-transform: none;
            transform: none;
  }
}

.fadeInUp {
  -webkit-animation-name: fadeInUp;
          animation-name: fadeInUp;
}
      

<h1 class="animated fadeInUp">Text text text</h1>
      

Run codeHide result


0


source







All Articles