【CSS】テキストを一文字ずつ上下から相互にフェードインさせる方法のデモページ

※デベロッパーツール等でソースコードをご確認ください(Please check using Developer tools)

マイナビAGENT

DummyText

スポンサーリンク

マイナビAGENT

HTML

<div class="wrap">
  <p class="text">DummyText</p>
</div>

JavaScript

$(function(){
  $('.text').children().addBack().contents().each(function() {
      $(this).replaceWith($(this).text().replace(/(\S)/g, '<span class="text-move">$&</span>'));
  });
   setTimeout(function(){
      $(".text").addClass("active");
  },100);
});

CSS

.wrap {
  width: 768px;
  margin: 0 auto;
}
.text {
  margin: 50px 0 0;
  text-align: center;
  font-size: 80px;
}

.text-move {
  display: inline-block;
  opacity: 0;;
  will-change: transform;
}
.text-move:nth-child(odd) {
  transform: translate3d(30px,-50px,0) rotateY(45deg) skewX(-35deg);
}
.text-move:nth-child(even) {
  transform: translate3d(-30px,50px,0) rotateY(45deg) skewX(-35deg);
}

.text.active .text-move:nth-child(1) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.07s cubic-bezier(.08,.92,.35,1),opacity 1s 1.17s;
}
.text.active .text-move:nth-child(2) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.14s cubic-bezier(.08,.92,.35,1),opacity 1s 1.24s;
}
.text.active .text-move:nth-child(3) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.21s cubic-bezier(.08,.92,.35,1),opacity 1s 1.31s;
}
.text.active .text-move:nth-child(4) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.28s cubic-bezier(.08,.92,.35,1),opacity 1s 1.38s;
}
.text.active .text-move:nth-child(5) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.35s cubic-bezier(.08,.92,.35,1),opacity 1s 1.45s;
}
.text.active .text-move:nth-child(6) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.42s cubic-bezier(.08,.92,.35,1),opacity 1s 1.52s;
}
.text.active .text-move:nth-child(7) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.49s cubic-bezier(.08,.92,.35,1),opacity 1s 1.59s;
}
.text.active .text-move:nth-child(8) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.56s cubic-bezier(.08,.92,.35,1),opacity 1s 1.66s;
}
.text.active .text-move:nth-child(9) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.63s cubic-bezier(.08,.92,.35,1),opacity 1s 1.73s;
}
.text.active .text-move:nth-child(10) {
  transform: translate3d(0,0,0) rotateY(0deg) skewX(0deg);
  transition: transform 1s 1.7s cubic-bezier(.08,.92,.35,1),opacity 1s 1.8s;
}

.text.active .text-move {
  opacity: 1;
  transform: translate(0);
}

@media screen and (max-width:640px){
  .wrap {
    width: 100%;
  }
  .text-move {
    font-size: 8vw;
  }
}