1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

スクロールアニメーション

Posted at

パターン1

イメージ

download-1.gif

HTML

HTML
<a class="scroll" href="#link-about" data-scroll="" aria-label="scroll" title="scroll">
  <div class="scroll__inner">
    <div class="scroll--line"></div>
    <div class="scroll--scroller"></div>
  </div>
</a>

CSS

CSS
.scroll {
  position: absolute;
  right: 6vw;
  bottom: -11%;
  z-index: 1;
  width: 1.5625vw;
  height: 135px;
  overflow: hidden;
}

.scroll__inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.scroll--line {
  position: absolute;
  top: 0;
  left: 0.78vw;
  width: 1px;
  height: 100%;
  background-color: #6c6e73;
}

.scroll--scroller:before {
  position: absolute;
  top: -10px;
  left: 50%;
  display: inline-block;
  width: 8px;
  height: 8px;
  content: "";
  background-color: #6c6e73;
  border-radius: 50%;
  -webkit-animation: loop 2.5s ease 0s infinite normal;
          animation: loop 2.5s ease 0s infinite normal;
}

@-webkit-keyframes loop {

  0% {
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
  }

  100% {
    -webkit-transform: translate3d(-50%, 145px, 0);
    transform: translate3d(-50%, 145px, 0);
  }
}

@keyframes loop {

  0% {
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
  }

  100% {
    -webkit-transform: translate3d(-50%, 145px, 0);
    transform: translate3d(-50%, 145px, 0);
  }
}

パターン2

イメージ

download.gif (773.5 kB)

HTML

HTML
  <a href="#about" class="scroll__box">
    <p class="scroll__txt">SCROLL</p>
    <div class="scroll" data-scroll="" aria-label="scroll" title="scroll">
      <span class="scroll--line"></span>
    </div>
  </a>

CSS

CSS
.scroll__box {
  position: relative;
  display: inline-block;
  margin-top: 56px;
}

.scroll__txt {
  letter-spacing: 0.1em;
}

.scroll {
  position: absolute;
  top: 34px;
  right: 0;
  left: 0;
  z-index: 1;
  display: inline-block;
  margin: auto;
  overflow: hidden;
}

.scroll--line {
  display: inline-block;
  width: 2px;
  height: 100px;
  background: #fff;
}

.scroll--line::before {
  position: absolute;
  top: -110px;
  right: -2px;
  left: 0;
  z-index: 2;
  width: 2px;
  height: 100%;
  margin: 0 auto;
  content: "";
  background: #565656;
  -webkit-transform: translateY(-100%);
  -ms-transform: translateY(-100%);
  transform: translateY(-100%);
  -webkit-transform-origin: top;
  -ms-transform-origin: top;
  transform-origin: top;
  -webkit-animation: loop 3s cubic-bezier(0.57, 0.05, 0.52, 0.96) infinite;
  animation: loop 3s cubic-bezier(0.57, 0.05, 0.52, 0.96) infinite;
}

@-webkit-keyframes loop {

  0% {
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
  }

  100% {
    -webkit-transform: translate3d(-50%, 210px, 0);
    transform: translate3d(-50%, 210px, 0);
  }
}

@keyframes loop {

  0% {
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
  }

  100% {
    -webkit-transform: translate3d(-50%, 210px, 0);
    transform: translate3d(-50%, 210px, 0);
  }
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?