Web_Basic
  • Introduction
  • Web Component
  • HTML basic
  • CSS basic
    • Inline element 與 Block element
    • 實用CSS 技巧
    • CSS Grid 教學
  • CSS Advance
    • Adobe spectrum
    • CSS Tricks
    • Contain block
    • OOCSS、SMACSS、BEM、SEM、BIO
    • z-index
    • Flexbox教學
    • 使用Materialize css
    • 使用Semantic UI
    • 使用Bootstrap
    • Ant design
    • Less
    • Animation
    • 簡單的特效
    • SCSS
  • Javascript basic
  • 開始寫一個網站前
    • 寫一個靜態網站2
    • 寫一個靜態網站
  • 部屬到github pages
  • 做一個OX小遊戲
  • 做一個貪食蛇小遊戲
  • canvas
  • Regexp
  • SVG
  • Sublime快捷鍵
  • Deploy Blog 使用 Hexo
  • 域名設定
    • 註冊域名信箱
      • 使用AWS SES
      • mailgun
    • subdomain,清除DNS快取
  • 使用cloudflare
  • 使用VNC server
  • SEO
    • Sitemap
    • search console
  • 遠端連線
  • HTML LiveReload
  • ngrok 與 local tunnel
  • Service worker 與 Cache
  • Zeplin 搭配 Sketch
  • 測試 IE 網頁相容性
  • 網站產生器
Powered by GitBook
On this page
  • Animation
  • 1.Transition
  • 如何使用:
  • 2.Animation
  • 1.指定keyframe
  • 2.設定animation

Was this helpful?

  1. CSS Advance

Animation

Animation

1.Transition

(簡單版的動畫)

用途:如果有hover或click改變某元素style屬性時,可加上

transition: width 2s, height 2s, transform 2s,background 2s;

來讓元素在改變style時加上transition效果

如何使用:

short-cut

transition: width      2s           linear       1s;
           元素屬性  幾秒鐘的動畫   如何進行動畫  延遲幾秒開始

或是個別指定

  background: #2db34a;
  transition-property: background;
  transition-duration: 1s;
  transition-timing-function: linear;

2.Animation

(複雜版的動畫)

1.指定keyframe

(下面這個只可指定開始與結束)

@keyframes mymove {
    from {left: 0px;}
    to {left: 200px;}
}

或是(下面的方法可指定許多關鍵影格)

@keyframes mymove {
    0% {left: 0px;}
    100% {left: 200px;}
}

2.設定animation

animation: test  1s 2s 3 alternate 
        //keyframe名稱、持續時間、delay、重複次數、動畫作用方向
PreviousLessNext簡單的特效

Last updated 5 years ago

Was this helpful?

可參考:

http://www.openfoundry.org/tw/tech-column/9233-css3-animation