steemit.com upvote按钮的动画如何工作?

时间:2017-12-13 12:51:15

标签: javascript html css animation svg

所以这是steemit.com的upvote按钮:

int *pi = getMaxElement( i, sizeof( i ) / sizeof( *i ) );
++*pi;

printf( "%d\n", *pi );

现在我想知道鼠标悬停动画是如何工作的?用鼠标悬停按钮时,我没有看到上述任何代码发生变化。

1 个答案:

答案 0 :(得分:1)

span正在发生这种情况。它有悬停动画。 Fiddle



a.Voting__button-up, path, circle {
    transition: opacity, fill, stroke .3s ease 0s;
}
a.Voting__button-up:hover circle{
    fill: #06D6A9;
    stroke: #06D6A9;
}
.Voting__button-up .Icon:hover {
    box-shadow: 0 0 0 #4ba2f2;
    -webkit-animation: pulse 2s infinite;
    animation: pulse 2s infinite;
}
.Voting__button-up .Icon {
    margin-left: 0;
    border-radius: 50%;
}
.Voting__button .Icon {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}
@keyframes pulse{
  0% {
      box-shadow: 0 0 0 0 #06d6a9;
  }
  70% {
      box-shadow: 0 0 0 10px rgba(6, 214, 169, 0);
  }
  100% {
      box-shadow: 0 0 0 0 rgba(6, 214, 169, 0);
  }
}

<a href="" class="Voting__button-up">
<span class="Icon chevron-up-circle" style="display: inline-block; width: 1.12rem; height: 1.12rem;">
  <svg enable-background="new 0 0 33 33" version="1.1" viewBox="0 0 33 33" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
     <g id="Chevron_Up_Circle"><circle cx="16" cy="16" r="15" stroke="#121313" fill="none"></circle>
         <path d="M16.699,11.293c-0.384-0.38-1.044-0.381-1.429,0l-6.999,6.899c-0.394,0.391-0.394,1.024,0,1.414 c0.395,0.391,1.034,0.391,1.429,0l6.285-6.195l6.285,6.196c0.394,0.391,1.034,0.391,1.429,0c0.394-0.391,0.394-1.024,0-1.414 L16.699,11.293z" fill="#121313"></path>
     </g>
  </svg>
</span>
</a>
&#13;
&#13;
&#13;