Can you animate a font awesome icon? [closed]

2019-08-09 11:36发布

I have a webpage with a paper airplane icon from font awesome. Is it possible, since it is a font, to make it have a small animation? For example, make it shrink and fly away and the appear from under? With jQuery, javascript or CSS?

plane

2条回答
混吃等死
2楼-- · 2019-08-09 11:41

Sure! It doesn’t matter if it’s a font icon or an SVG icon, you can still animate the element with CSS.

Here’s an example animation:

@keyframes fly {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(0.5);
  }
  100% {
    transform: scale(0.5) translate(100vw, -100vh);
  }
}

.plane {
  display: inline-block;
  fill: #e24145;// for demo purposes, only applies to SVGs

  &.is-active {
    animation-name: fly;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-in;
  }
}

Working demo http://codepen.io/tedw/pen/PZXjYv

查看更多
疯言疯语
3楼-- · 2019-08-09 11:52

JQuery Animation

Here's an example using JQuery and CSS. I'm using a rocket icon (

查看更多
登录 后发表回答