├── .gitignore ├── Makefile ├── README.md ├── build ├── epub │ └── book.epub └── html │ ├── book.html │ ├── images │ ├── ab-min.gif │ ├── ab.gif │ ├── ab.jpg │ ├── ab.png │ ├── ab_animated.png │ ├── abc.png │ ├── animation-fill-mode.gif │ ├── animators_survival_kit_frame.jpg │ ├── baymax-min.gif │ ├── baymax.gif │ ├── baymax.png │ ├── button-element-positioning.png │ ├── button-element-positioning2.png │ ├── button-min.gif │ ├── button.gif │ ├── button.png │ ├── cat-min.gif │ ├── cat.gif │ ├── cat.png │ ├── change-background-min.gif │ ├── change-background.gif │ ├── change-background.png │ ├── course-min.gif │ ├── course.gif │ ├── course.png │ ├── cover-small.png │ ├── cover.png │ ├── css-starwars-min.gif │ ├── css-starwars.gif │ ├── css-starwars.png │ ├── cubic-bezier-graph.png │ ├── cubic-bezier-min.gif │ ├── cubic-bezier.gif │ ├── cubic-bezier.png │ ├── demo-min.gif │ ├── demo.gif │ ├── demo.png │ ├── donovan.jpg │ ├── donovan_hutchinson.jpg │ ├── ease-in-min.gif │ ├── ease-in-out-min.gif │ ├── ease-in-out.gif │ ├── ease-in.gif │ ├── ease-out-min.gif │ ├── ease-out.gif │ ├── fabric-min.gif │ ├── fabric.gif │ ├── files.jpg │ ├── js-triggered-button-min.gif │ ├── js-triggered-button.gif │ ├── linear-example-min.gif │ ├── linear-example.gif │ ├── linear-min.gif │ ├── linear.gif │ ├── list_item-min.gif │ ├── list_item.gif │ ├── macplus-min.gif │ ├── macplus.gif │ ├── mailchimp-min.gif │ ├── mailchimp.gif │ ├── multiple-button-min.gif │ ├── multiple-button.gif │ ├── portal-min.gif │ ├── portal.gif │ ├── ribbon-min.gif │ ├── ribbon.gif │ ├── save_button-min.gif │ ├── save_button.gif │ ├── screen-hover-min.gif │ ├── screen-hover.gif │ ├── screen-min.gif │ ├── screen.gif │ ├── scroll-min.gif │ ├── scroll.gif │ ├── sheen-min.gif │ ├── sheen.gif │ ├── simple-keyframes-alternating-min.gif │ ├── simple-keyframes-alternating.gif │ ├── simple-keyframes-min.gif │ ├── simple-keyframes.gif │ ├── sprout-min.gif │ ├── sprout.gif │ ├── starwars-min.gif │ ├── starwars.gif │ ├── starwars.png │ ├── steps-min.gif │ ├── steps.gif │ ├── steps.png │ ├── traffic-light-grid.png │ ├── traffic-lights-min.gif │ ├── traffic-lights.gif │ ├── transitions-animations-min.gif │ ├── transitions-animations.gif │ ├── transitions-min.gif │ ├── transitions.gif │ ├── wiggle-min.gif │ ├── wiggle.gif │ ├── winnie-min.gif │ └── winnie.gif │ └── style.css ├── chapters ├── 01 │ ├── 01.md │ ├── 02.md │ ├── 03.md │ ├── 04.md │ └── 05.md ├── 02 │ ├── 01.md │ ├── 02.md │ ├── 03.md │ ├── 04.md │ └── 05.md ├── 03 │ ├── 01.md │ ├── 02.md │ ├── 03.md │ ├── 04.md │ └── 05.md ├── 04 │ ├── 01.md │ ├── 02.md │ ├── 03.md │ ├── 04.md │ └── 05.md ├── 05 │ └── 01.md └── dictionary.md ├── docs ├── images │ ├── ab-min.gif │ ├── ab.gif │ ├── ab.jpg │ ├── ab.png │ ├── ab_animated.png │ ├── abc.png │ ├── animation-fill-mode.gif │ ├── animators_survival_kit_frame.jpg │ ├── baymax-min.gif │ ├── baymax.gif │ ├── baymax.png │ ├── button-element-positioning.png │ ├── button-element-positioning2.png │ ├── button-min.gif │ ├── button.gif │ ├── button.png │ ├── cat-min.gif │ ├── cat.gif │ ├── cat.png │ ├── change-background-min.gif │ ├── change-background.gif │ ├── change-background.png │ ├── course-min.gif │ ├── course.gif │ ├── course.png │ ├── cover-small.png │ ├── cover.png │ ├── css-starwars-min.gif │ ├── css-starwars.gif │ ├── css-starwars.png │ ├── cubic-bezier-graph.png │ ├── cubic-bezier-min.gif │ ├── cubic-bezier.gif │ ├── cubic-bezier.png │ ├── demo-min.gif │ ├── demo.gif │ ├── demo.png │ ├── donovan.jpg │ ├── donovan_hutchinson.jpg │ ├── ease-in-min.gif │ ├── ease-in-out-min.gif │ ├── ease-in-out.gif │ ├── ease-in.gif │ ├── ease-out-min.gif │ ├── ease-out.gif │ ├── fabric-min.gif │ ├── fabric.gif │ ├── files.jpg │ ├── js-triggered-button-min.gif │ ├── js-triggered-button.gif │ ├── linear-example-min.gif │ ├── linear-example.gif │ ├── linear-min.gif │ ├── linear.gif │ ├── list_item-min.gif │ ├── list_item.gif │ ├── macplus-min.gif │ ├── macplus.gif │ ├── mailchimp-min.gif │ ├── mailchimp.gif │ ├── multiple-button-min.gif │ ├── multiple-button.gif │ ├── portal-min.gif │ ├── portal.gif │ ├── ribbon-min.gif │ ├── ribbon.gif │ ├── save_button-min.gif │ ├── save_button.gif │ ├── screen-hover-min.gif │ ├── screen-hover.gif │ ├── screen-min.gif │ ├── screen.gif │ ├── scroll-min.gif │ ├── scroll.gif │ ├── sheen-min.gif │ ├── sheen.gif │ ├── simple-keyframes-alternating-min.gif │ ├── simple-keyframes-alternating.gif │ ├── simple-keyframes-min.gif │ ├── simple-keyframes.gif │ ├── sprout-min.gif │ ├── sprout.gif │ ├── starwars-min.gif │ ├── starwars.gif │ ├── starwars.png │ ├── steps-min.gif │ ├── steps.gif │ ├── steps.png │ ├── traffic-light-grid.png │ ├── traffic-lights-min.gif │ ├── traffic-lights.gif │ ├── transitions-animations-min.gif │ ├── transitions-animations.gif │ ├── transitions-min.gif │ ├── transitions.gif │ ├── wiggle-min.gif │ ├── wiggle.gif │ ├── winnie-min.gif │ └── winnie.gif ├── index.html └── style.css ├── images ├── ab-min.gif ├── ab.gif ├── ab.jpg ├── ab.png ├── ab_animated.png ├── abc.png ├── animation-fill-mode.gif ├── animators_survival_kit_frame.jpg ├── baymax-min.gif ├── baymax.gif ├── baymax.png ├── button-element-positioning.png ├── button-element-positioning2.png ├── button-min.gif ├── button.gif ├── button.png ├── cat-min.gif ├── cat.gif ├── cat.png ├── change-background-min.gif ├── change-background.gif ├── change-background.png ├── course-min.gif ├── course.gif ├── course.png ├── cover-small.png ├── cover.png ├── css-starwars-min.gif ├── css-starwars.gif ├── css-starwars.png ├── cubic-bezier-graph.png ├── cubic-bezier-min.gif ├── cubic-bezier.gif ├── cubic-bezier.png ├── demo-min.gif ├── demo.gif ├── demo.png ├── donovan.jpg ├── donovan_hutchinson.jpg ├── ease-in-min.gif ├── ease-in-out-min.gif ├── ease-in-out.gif ├── ease-in.gif ├── ease-out-min.gif ├── ease-out.gif ├── fabric-min.gif ├── fabric.gif ├── files.jpg ├── js-triggered-button-min.gif ├── js-triggered-button.gif ├── linear-example-min.gif ├── linear-example.gif ├── linear-min.gif ├── linear.gif ├── list_item-min.gif ├── list_item.gif ├── macplus-min.gif ├── macplus.gif ├── mailchimp-min.gif ├── mailchimp.gif ├── multiple-button-min.gif ├── multiple-button.gif ├── portal-min.gif ├── portal.gif ├── ribbon-min.gif ├── ribbon.gif ├── save_button-min.gif ├── save_button.gif ├── screen-hover-min.gif ├── screen-hover.gif ├── screen-min.gif ├── screen.gif ├── scroll-min.gif ├── scroll.gif ├── sheen-min.gif ├── sheen.gif ├── simple-keyframes-alternating-min.gif ├── simple-keyframes-alternating.gif ├── simple-keyframes-min.gif ├── simple-keyframes.gif ├── sprout-min.gif ├── sprout.gif ├── starwars-min.gif ├── starwars.gif ├── starwars.png ├── steps-min.gif ├── steps.gif ├── steps.png ├── traffic-light-grid.png ├── traffic-lights-min.gif ├── traffic-lights.gif ├── transitions-animations-min.gif ├── transitions-animations.gif ├── transitions-min.gif ├── transitions.gif ├── wiggle-min.gif ├── wiggle.gif ├── winnie-min.gif └── winnie.gif ├── metadata.yml └── style.css /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BUILD = build 2 | DOCS = docs 3 | OUTPUT_FILENAME = book 4 | DOCS_FILENAME = index 5 | METADATA = metadata.yml 6 | CHAPTERS = chapters/**/*.md 7 | TOC = --toc --toc-depth=2 8 | IMAGES_FOLDER = images 9 | COVER_IMAGE = images/cover.png 10 | LATEX_CLASS = report 11 | MATH_FORMULAS = --webtex 12 | CSS_FILE = style.css 13 | CSS_ARG = --css=$(CSS_FILE) 14 | ARGS = $(TOC) $(MATH_FORMULAS) $(CSS_ARG) 15 | 16 | all: book 17 | 18 | book: epub html pdf docs 19 | 20 | clean: 21 | rm -r $(BUILD) 22 | rm -r $(DOCS) 23 | 24 | epub: $(BUILD)/epub/$(OUTPUT_FILENAME).epub 25 | 26 | html: $(BUILD)/html/$(OUTPUT_FILENAME).html 27 | 28 | pdf: $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf 29 | 30 | docs: $(DOCS)/$(DOCS_FILENAME).html 31 | 32 | $(BUILD)/epub/$(OUTPUT_FILENAME).epub: $(METADATA) $(CHAPTERS) 33 | mkdir -p $(BUILD)/epub 34 | pandoc $(ARGS) --epub-metadata=$(METADATA) --epub-cover-image=$(COVER_IMAGE) -o $@ $^ 35 | 36 | $(BUILD)/html/$(OUTPUT_FILENAME).html: $(CHAPTERS) 37 | mkdir -p $(BUILD)/html 38 | pandoc $(ARGS) --standalone --to=html5 -o $@ $^ 39 | cp -R $(IMAGES_FOLDER)/ $(BUILD)/html/$(IMAGES_FOLDER)/ 40 | cp $(CSS_FILE) $(BUILD)/html/$(CSS_FILE) 41 | 42 | $(BUILD)/pdf/$(OUTPUT_FILENAME).pdf: $(METADATA) $(CHAPTERS) 43 | mkdir -p $(BUILD)/pdf 44 | pandoc $(ARGS) -V documentclass=$(LATEX_CLASS) -o $@ $^ 45 | 46 | 47 | $(DOCS)/$(DOCS_FILENAME).html: $(CHAPTERS) 48 | mkdir -p $(DOCS) 49 | pandoc $(ARGS) --standalone --to=html5 -o $@ $^ 50 | cp -R $(IMAGES_FOLDER)/ $(DOCS)/$(IMAGES_FOLDER)/ 51 | cp $(CSS_FILE) $(DOCS)/$(CSS_FILE) 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSS Animation 101 2 | 3 | ![https://raw.githubusercontent.com/cssanimation/css-animation-101/master/images/cover-small.png](https://raw.githubusercontent.com/cssanimation/css-animation-101/master/images/cover-small.png) 4 | 5 | 学习 CSS Animation, 助你升职加薪,迎娶白富美,走上人生巅峰。 6 | 7 | 本书理论与实践相结合,通过大量的例子来讲解 animation 的知识。 8 | 9 | ## 下载 10 | 11 | ##### 英文版本 12 | 13 | * [Web version](https://cssanimation.rocks/css-animation-101/) 14 | * [PDF version](https://github.com/cssanimation/css-animation-101/raw/master/downloads/pdf/cssanimation-101.pdf) 15 | * [ePub version](https://github.com/cssanimation/css-animation-101/raw/master/downloads/epub/cssanimation-101.epub) 16 | 17 | 更多教程,请查看:[cssanimation.rocks](https://cssanimation.rocks) 18 | 19 | ##### 中文版本 20 | 21 | * [Web version](https://h-wakanda.github.io/css-animation-101-cn/) 22 | * [ePub version](https://github.com/H-Wakanda/css-animation-101-cn/blob/master/build/epub/book.epub) 23 | 24 | ## 原文链接 25 | 26 | [https://github.com/cssanimation/css-animation-101](https://github.com/cssanimation/css-animation-101) 27 | 28 | ## 作者 29 | 30 | + [Twitter](https://twitter.com/cssanimation) 31 | + [GitHub](https://github.com/cssanimation) 32 | 33 | 34 | ## 翻译 35 | 36 | - 佚名 37 | - [caoshuangna](http://caoshuangna.surge.sh/) 38 | - xuanyuan 39 | - [helloca](http://helloca.surge.sh/) 40 | - lvlinlin 41 | 42 | ## 许可证 43 | 44 | 本书遵循 [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) 许可证,你懂的,要有署名的。 45 | -------------------------------------------------------------------------------- /build/epub/book.epub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/epub/book.epub -------------------------------------------------------------------------------- /build/html/images/ab-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ab-min.gif -------------------------------------------------------------------------------- /build/html/images/ab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ab.gif -------------------------------------------------------------------------------- /build/html/images/ab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ab.jpg -------------------------------------------------------------------------------- /build/html/images/ab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ab.png -------------------------------------------------------------------------------- /build/html/images/ab_animated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ab_animated.png -------------------------------------------------------------------------------- /build/html/images/abc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/abc.png -------------------------------------------------------------------------------- /build/html/images/animation-fill-mode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/animation-fill-mode.gif -------------------------------------------------------------------------------- /build/html/images/animators_survival_kit_frame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/animators_survival_kit_frame.jpg -------------------------------------------------------------------------------- /build/html/images/baymax-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/baymax-min.gif -------------------------------------------------------------------------------- /build/html/images/baymax.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/baymax.gif -------------------------------------------------------------------------------- /build/html/images/baymax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/baymax.png -------------------------------------------------------------------------------- /build/html/images/button-element-positioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/button-element-positioning.png -------------------------------------------------------------------------------- /build/html/images/button-element-positioning2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/button-element-positioning2.png -------------------------------------------------------------------------------- /build/html/images/button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/button-min.gif -------------------------------------------------------------------------------- /build/html/images/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/button.gif -------------------------------------------------------------------------------- /build/html/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/button.png -------------------------------------------------------------------------------- /build/html/images/cat-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cat-min.gif -------------------------------------------------------------------------------- /build/html/images/cat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cat.gif -------------------------------------------------------------------------------- /build/html/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cat.png -------------------------------------------------------------------------------- /build/html/images/change-background-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/change-background-min.gif -------------------------------------------------------------------------------- /build/html/images/change-background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/change-background.gif -------------------------------------------------------------------------------- /build/html/images/change-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/change-background.png -------------------------------------------------------------------------------- /build/html/images/course-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/course-min.gif -------------------------------------------------------------------------------- /build/html/images/course.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/course.gif -------------------------------------------------------------------------------- /build/html/images/course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/course.png -------------------------------------------------------------------------------- /build/html/images/cover-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cover-small.png -------------------------------------------------------------------------------- /build/html/images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cover.png -------------------------------------------------------------------------------- /build/html/images/css-starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/css-starwars-min.gif -------------------------------------------------------------------------------- /build/html/images/css-starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/css-starwars.gif -------------------------------------------------------------------------------- /build/html/images/css-starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/css-starwars.png -------------------------------------------------------------------------------- /build/html/images/cubic-bezier-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cubic-bezier-graph.png -------------------------------------------------------------------------------- /build/html/images/cubic-bezier-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cubic-bezier-min.gif -------------------------------------------------------------------------------- /build/html/images/cubic-bezier.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cubic-bezier.gif -------------------------------------------------------------------------------- /build/html/images/cubic-bezier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/cubic-bezier.png -------------------------------------------------------------------------------- /build/html/images/demo-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/demo-min.gif -------------------------------------------------------------------------------- /build/html/images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/demo.gif -------------------------------------------------------------------------------- /build/html/images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/demo.png -------------------------------------------------------------------------------- /build/html/images/donovan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/donovan.jpg -------------------------------------------------------------------------------- /build/html/images/donovan_hutchinson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/donovan_hutchinson.jpg -------------------------------------------------------------------------------- /build/html/images/ease-in-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-in-min.gif -------------------------------------------------------------------------------- /build/html/images/ease-in-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-in-out-min.gif -------------------------------------------------------------------------------- /build/html/images/ease-in-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-in-out.gif -------------------------------------------------------------------------------- /build/html/images/ease-in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-in.gif -------------------------------------------------------------------------------- /build/html/images/ease-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-out-min.gif -------------------------------------------------------------------------------- /build/html/images/ease-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ease-out.gif -------------------------------------------------------------------------------- /build/html/images/fabric-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/fabric-min.gif -------------------------------------------------------------------------------- /build/html/images/fabric.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/fabric.gif -------------------------------------------------------------------------------- /build/html/images/files.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/files.jpg -------------------------------------------------------------------------------- /build/html/images/js-triggered-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/js-triggered-button-min.gif -------------------------------------------------------------------------------- /build/html/images/js-triggered-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/js-triggered-button.gif -------------------------------------------------------------------------------- /build/html/images/linear-example-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/linear-example-min.gif -------------------------------------------------------------------------------- /build/html/images/linear-example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/linear-example.gif -------------------------------------------------------------------------------- /build/html/images/linear-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/linear-min.gif -------------------------------------------------------------------------------- /build/html/images/linear.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/linear.gif -------------------------------------------------------------------------------- /build/html/images/list_item-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/list_item-min.gif -------------------------------------------------------------------------------- /build/html/images/list_item.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/list_item.gif -------------------------------------------------------------------------------- /build/html/images/macplus-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/macplus-min.gif -------------------------------------------------------------------------------- /build/html/images/macplus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/macplus.gif -------------------------------------------------------------------------------- /build/html/images/mailchimp-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/mailchimp-min.gif -------------------------------------------------------------------------------- /build/html/images/mailchimp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/mailchimp.gif -------------------------------------------------------------------------------- /build/html/images/multiple-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/multiple-button-min.gif -------------------------------------------------------------------------------- /build/html/images/multiple-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/multiple-button.gif -------------------------------------------------------------------------------- /build/html/images/portal-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/portal-min.gif -------------------------------------------------------------------------------- /build/html/images/portal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/portal.gif -------------------------------------------------------------------------------- /build/html/images/ribbon-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ribbon-min.gif -------------------------------------------------------------------------------- /build/html/images/ribbon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/ribbon.gif -------------------------------------------------------------------------------- /build/html/images/save_button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/save_button-min.gif -------------------------------------------------------------------------------- /build/html/images/save_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/save_button.gif -------------------------------------------------------------------------------- /build/html/images/screen-hover-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/screen-hover-min.gif -------------------------------------------------------------------------------- /build/html/images/screen-hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/screen-hover.gif -------------------------------------------------------------------------------- /build/html/images/screen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/screen-min.gif -------------------------------------------------------------------------------- /build/html/images/screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/screen.gif -------------------------------------------------------------------------------- /build/html/images/scroll-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/scroll-min.gif -------------------------------------------------------------------------------- /build/html/images/scroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/scroll.gif -------------------------------------------------------------------------------- /build/html/images/sheen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/sheen-min.gif -------------------------------------------------------------------------------- /build/html/images/sheen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/sheen.gif -------------------------------------------------------------------------------- /build/html/images/simple-keyframes-alternating-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/simple-keyframes-alternating-min.gif -------------------------------------------------------------------------------- /build/html/images/simple-keyframes-alternating.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/simple-keyframes-alternating.gif -------------------------------------------------------------------------------- /build/html/images/simple-keyframes-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/simple-keyframes-min.gif -------------------------------------------------------------------------------- /build/html/images/simple-keyframes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/simple-keyframes.gif -------------------------------------------------------------------------------- /build/html/images/sprout-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/sprout-min.gif -------------------------------------------------------------------------------- /build/html/images/sprout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/sprout.gif -------------------------------------------------------------------------------- /build/html/images/starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/starwars-min.gif -------------------------------------------------------------------------------- /build/html/images/starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/starwars.gif -------------------------------------------------------------------------------- /build/html/images/starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/starwars.png -------------------------------------------------------------------------------- /build/html/images/steps-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/steps-min.gif -------------------------------------------------------------------------------- /build/html/images/steps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/steps.gif -------------------------------------------------------------------------------- /build/html/images/steps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/steps.png -------------------------------------------------------------------------------- /build/html/images/traffic-light-grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/traffic-light-grid.png -------------------------------------------------------------------------------- /build/html/images/traffic-lights-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/traffic-lights-min.gif -------------------------------------------------------------------------------- /build/html/images/traffic-lights.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/traffic-lights.gif -------------------------------------------------------------------------------- /build/html/images/transitions-animations-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/transitions-animations-min.gif -------------------------------------------------------------------------------- /build/html/images/transitions-animations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/transitions-animations.gif -------------------------------------------------------------------------------- /build/html/images/transitions-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/transitions-min.gif -------------------------------------------------------------------------------- /build/html/images/transitions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/transitions.gif -------------------------------------------------------------------------------- /build/html/images/wiggle-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/wiggle-min.gif -------------------------------------------------------------------------------- /build/html/images/wiggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/wiggle.gif -------------------------------------------------------------------------------- /build/html/images/winnie-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/winnie-min.gif -------------------------------------------------------------------------------- /build/html/images/winnie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/build/html/images/winnie.gif -------------------------------------------------------------------------------- /build/html/style.css: -------------------------------------------------------------------------------- 1 | 2 | html { 3 | font-size: 100%; 4 | overflow-y: scroll; 5 | -webkit-text-size-adjust: 100%; 6 | -ms-text-size-adjust: 100%; 7 | } 8 | 9 | body { 10 | color: #444; 11 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; 12 | font-size: 12px; 13 | line-height: 1.7; 14 | padding: 1em; 15 | margin: auto; 16 | max-width: 42em; 17 | background: #fefefe; 18 | } 19 | 20 | a { 21 | color: #0645ad; 22 | text-decoration: none; 23 | } 24 | 25 | a:visited { 26 | color: #0b0080; 27 | } 28 | 29 | a:hover { 30 | color: #06e; 31 | } 32 | 33 | a:active { 34 | color: #faa700; 35 | } 36 | 37 | a:focus { 38 | outline: thin dotted; 39 | } 40 | 41 | *::-moz-selection { 42 | background: rgba(255, 255, 0, 0.3); 43 | color: #000; 44 | } 45 | 46 | *::selection { 47 | background: rgba(255, 255, 0, 0.3); 48 | color: #000; 49 | } 50 | 51 | a::-moz-selection { 52 | background: rgba(255, 255, 0, 0.3); 53 | color: #0645ad; 54 | } 55 | 56 | a::selection { 57 | background: rgba(255, 255, 0, 0.3); 58 | color: #0645ad; 59 | } 60 | 61 | p { 62 | margin: 1em 0; 63 | } 64 | 65 | img { 66 | max-width: 100%; 67 | } 68 | 69 | h1, h2, h3, h4, h5, h6 { 70 | color: #111; 71 | line-height: 125%; 72 | margin-top: 2em; 73 | font-weight: normal; 74 | } 75 | 76 | h4, h5, h6 { 77 | font-weight: bold; 78 | } 79 | 80 | h1 { 81 | font-size: 2.5em; 82 | } 83 | 84 | h2 { 85 | font-size: 2em; 86 | } 87 | 88 | h3 { 89 | font-size: 1.5em; 90 | } 91 | 92 | h4 { 93 | font-size: 1.2em; 94 | } 95 | 96 | h5 { 97 | font-size: 1em; 98 | } 99 | 100 | h6 { 101 | font-size: 0.9em; 102 | } 103 | 104 | blockquote { 105 | color: #666666; 106 | margin: 0; 107 | padding-left: 3em; 108 | border-left: 0.5em #EEE solid; 109 | } 110 | 111 | hr { 112 | display: block; 113 | height: 2px; 114 | border: 0; 115 | border-top: 1px solid #aaa; 116 | border-bottom: 1px solid #eee; 117 | margin: 1em 0; 118 | padding: 0; 119 | } 120 | 121 | pre, code, kbd, samp { 122 | color: #000; 123 | font-family: monospace, monospace; 124 | _font-family: 'courier new', monospace; 125 | font-size: 0.98em; 126 | } 127 | 128 | pre { 129 | white-space: pre; 130 | white-space: pre-wrap; 131 | word-wrap: break-word; 132 | } 133 | 134 | b, strong { 135 | font-weight: bold; 136 | } 137 | 138 | dfn { 139 | font-style: italic; 140 | } 141 | 142 | ins { 143 | background: #ff9; 144 | color: #000; 145 | text-decoration: none; 146 | } 147 | 148 | mark { 149 | background: #ff0; 150 | color: #000; 151 | font-style: italic; 152 | font-weight: bold; 153 | } 154 | 155 | sub, sup { 156 | font-size: 75%; 157 | line-height: 0; 158 | position: relative; 159 | vertical-align: baseline; 160 | } 161 | 162 | sup { 163 | top: -0.5em; 164 | } 165 | 166 | sub { 167 | bottom: -0.25em; 168 | } 169 | 170 | ul, ol { 171 | margin: 1em 0; 172 | padding: 0 0 0 2em; 173 | } 174 | 175 | li p:last-child { 176 | margin-bottom: 0; 177 | } 178 | 179 | ul ul, ol ol { 180 | margin: .3em 0; 181 | } 182 | 183 | dl { 184 | margin-bottom: 1em; 185 | } 186 | 187 | dt { 188 | font-weight: bold; 189 | margin-bottom: .8em; 190 | } 191 | 192 | dd { 193 | margin: 0 0 .8em 2em; 194 | } 195 | 196 | dd:last-child { 197 | margin-bottom: 0; 198 | } 199 | 200 | img { 201 | border: 0; 202 | -ms-interpolation-mode: bicubic; 203 | vertical-align: middle; 204 | } 205 | 206 | figure { 207 | display: block; 208 | text-align: center; 209 | margin: 1em 0; 210 | } 211 | 212 | figure img { 213 | border: none; 214 | margin: 0 auto; 215 | } 216 | 217 | figcaption { 218 | font-size: 0.8em; 219 | font-style: italic; 220 | margin: 0 0 .8em; 221 | } 222 | 223 | table { 224 | margin-bottom: 2em; 225 | border-bottom: 1px solid #ddd; 226 | border-right: 1px solid #ddd; 227 | border-spacing: 0; 228 | border-collapse: collapse; 229 | } 230 | 231 | table th { 232 | padding: .2em 1em; 233 | background-color: #eee; 234 | border-top: 1px solid #ddd; 235 | border-left: 1px solid #ddd; 236 | } 237 | 238 | table td { 239 | padding: .2em 1em; 240 | border-top: 1px solid #ddd; 241 | border-left: 1px solid #ddd; 242 | vertical-align: top; 243 | } 244 | 245 | .author { 246 | font-size: 1.2em; 247 | text-align: center; 248 | } 249 | 250 | @media only screen and (min-width: 480px) { 251 | body { 252 | font-size: 14px; 253 | } 254 | } 255 | @media only screen and (min-width: 768px) { 256 | body { 257 | font-size: 16px; 258 | } 259 | } 260 | @media print { 261 | * { 262 | background: transparent !important; 263 | color: black !important; 264 | filter: none !important; 265 | -ms-filter: none !important; 266 | } 267 | 268 | body { 269 | font-size: 12pt; 270 | max-width: 100%; 271 | } 272 | 273 | a, a:visited { 274 | text-decoration: underline; 275 | } 276 | 277 | hr { 278 | height: 1px; 279 | border: 0; 280 | border-bottom: 1px solid black; 281 | } 282 | 283 | a[href]:after { 284 | content: " (" attr(href) ")"; 285 | } 286 | 287 | abbr[title]:after { 288 | content: " (" attr(title) ")"; 289 | } 290 | 291 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { 292 | content: ""; 293 | } 294 | 295 | pre, blockquote { 296 | border: 1px solid #999; 297 | padding-right: 1em; 298 | page-break-inside: avoid; 299 | } 300 | 301 | tr, img { 302 | page-break-inside: avoid; 303 | } 304 | 305 | img { 306 | max-width: 100% !important; 307 | } 308 | 309 | @page :left { 310 | margin: 15mm 20mm 15mm 10mm; 311 | } 312 | 313 | @page :right { 314 | margin: 15mm 10mm 15mm 20mm; 315 | } 316 | 317 | p, h2, h3 { 318 | orphans: 3; 319 | widows: 3; 320 | } 321 | 322 | h2, h3 { 323 | page-break-after: avoid; 324 | } 325 | } 326 | -------------------------------------------------------------------------------- /chapters/01/01.md: -------------------------------------------------------------------------------- 1 | # Welcome 2 | 3 | > "Tell me and I forget. Teach me and I remember. Involve me and I learn." _Benjamin Franklin_ 4 | 5 | 欢迎来到 CSS Animation 101,感谢你选择这本书。 6 | 7 | 很高兴你选择学习 CSS Animation,本书会以轻松有趣的方式来介绍这个话题,希望能够带给你帮助。 8 | 9 | 我们会学习 CSS 中的 _transitions_ 以及 _animations_ 。我相信,当你读完本书之后,你会对 CSS animations 有一个更深的理解,也会在工作中更好地使用它。 10 | 11 | 在本书中,我们会学习如何搭建自己的开发环境,然后学习一些 animation 的例子。 12 | 13 | ## Hello,I'm Donovan 14 | 15 | ![Donovan Hutchinson](images/donovan_hutchinson.jpg) 16 | 17 | 大家好,我叫 Donovan ,是一名设计师和前端工程师。工作时间,我会依照 UX 的设计原则进行网站动效设计,以提升网站的用户体验。业余的时候我就会写一些文章。我写过很多关于 CSS 的文章,也在 Smashing Magazine, Net Magazine, Tuts+, Adobe Inspire 上发表过很多。这是我的个人网站 [Hop.ie](http://hop.ie/)。 18 | 19 | 今年以来,我一直在 [cssanimation.rocks](https://cssanimation.rocks/) 上写教程,主要是关于网页动效的,欢迎大家一起交流。 20 | 21 | 本书主要介绍 CSS 中的动画 (CSS animation) ,目的就是让大家了解 `transition` 和 `animation` 这些属性是干嘛的,内部的原理,以及如何使用。 22 | 23 | 等读完这本书,我相信大家一定可以在开发过程中运用这些技巧了。 24 | 25 | ## Book structure 26 | 27 | 本书涵盖以下内容: 28 | 29 | 1. 什么是动画(animation)?我将解释一下为啥我们需要动画,并且会简单介绍 `transition` 和 `animation` 属性,然后给大家看一些例子。 30 | 2. **transition** 属性。我们将会学习 transitions 的原理,以及如何控制它来制作动效。 31 | 3. **animation** 属性。我们将学习怎样使用 keyframe 来制作比 transition 复杂的多的动效。 32 | 4. 通过几个复杂的例子学习如何将 transition 和 animation 结合起来使用。还会向大家介绍一些有用的 CSS 资源和 JavaScript 工具。 33 | 34 | ## Help and support 35 | 36 | 如果大家有什么想法或者疑问,欢迎大家通过邮件([donovan@cssanimation.rocks](mailto:donovan@cssanimation.rocks)),或者 Twitter ([@donovanh](https://twitter.com/donovanh))联系我。 37 | 38 | ## Need to brush up on your CSS? 39 | 40 | 如果你是一个 CSS 新手,那你需要熟悉一下 CSS 的基础知识。基本上你只要了解什么是 CSS,什么是 CSS 属性就可以了。 41 | 42 | 这里有一些不错的入门资源推荐给大家: 43 | 44 | - [Interactive HTML/CSS tutorials](http://www.codeavengers.com/) 45 | - [Learn to Code HTML&CSS](https://learn.shayhowe.com/html-css/) 46 | 47 | ## Homework 48 | 49 | 每一章节后面都会有一个**课后作业**的部分,我会给大家出一些小题目,目的是让大家更好的学习以及巩固知识。做不做完全取决于你,当然,我建议大家最好都去想一下做一下,你会发现自己对 CSS 动画的理解会更加深刻。 50 | 51 | **准备好了么**?让我们开始吧! 52 | -------------------------------------------------------------------------------- /chapters/01/02.md: -------------------------------------------------------------------------------- 1 | # Why Animation? 2 | 3 | > "Animation is about creating the illusion of life." Brad Bird 4 | 5 | 在深入学习 CSS 动画之前,我们先想想为啥需要动画。 6 | 7 | ## More than words alone 8 | 9 | 人们对会动的东西更加关注,所以在网站的设计和开发中,如果能适当地添加一些动画,不光可以丰富网站的视觉和交互体验,还能更有效地抓住用户的眼球,吸引他们的注意力,从而更加关注和沉浸在我们的网站里,这可比只用简单的文字好多了。而且现代浏览器的性能越来越高,对动画地支持也越来越好,更有利于我们使用动画了。【Tips:也不能滥用动画。如果滥用反而会造成注意力的分散。】 10 | 11 | ## What is animation on the web? 12 | 13 | 动画可以吸引用户注意力,同时完成信息的传递,这对网站有莫大的好处呀。 14 | 15 | 比如 CodePen 里面的保存按钮就有一个很别致的动画效果:当你修改文件之后,按钮就会抖动,提醒用户有文件需要保存。这样子的效果非常醒目,如果什么都不加,可能不少人会忘记要保存。 16 | 17 | ![Animation Saved Button](images/save_button-min.gif) 18 | 19 | 人类天生就对移动的物体敏感,这是人类进化的结果。在编写网页时花点小心思,添加点别致的小动画,会让人感受到你的匠心独运。 20 | 21 | 当元素在网页上出现时我们也可以添加动画。 22 | 23 | ![Animating list items (https://cssanimation.rocks/list-items/)](images/list_item-min.gif) 24 | 25 | 上面的例子中,通过动画让用户更加明显和生动地感受到有新内容添加到列表里了,而不是很生硬的一下子就出现,这样子体验会更好一些。多看几个例子: 26 | 27 | 游戏 [Portal](http://hop.ie/portal/): 28 | 29 | ![Portal animation](images/portal-min.gif) 30 | 31 | [sprout.js](http://sprout.is/): 32 | 33 | ![Animated chart from Sprout](images/sprout-min.gif) 34 | 35 | ## With great power comes great responsibility 36 | 37 | 给元素添加动画很简单,但要切记,在同一“时刻”不能添加太多。不然,不仅不能吸引注意力,让用户关注当前的内容或者操作,反而会让他们没有具体的关注点,不知道该干嘛。 38 | 39 | 当然,这只是大多数情况下的一种准则。【Tips:“不能添加太多”更多的是指不能让效果显得杂乱】 40 | 41 | 你完全可以使用大量的动画来创作炫目的效果。如果真的需要这么做的话,请注意:当用户需要关注的”点“(可能是某些文字、图片这种内容性的东西或者需要点击某个按钮这种操作性的东西)出现时,你应该考虑可以暂停这些效果,让他们好好的关注这些需要关注的东西。 42 | 43 | 下面的例子就很好的说明了这点:当需要指引用户去查看按钮的的时候,动画就停止了。 44 | 45 | ![National Parks from Rally Interactive](images/ribbon-min.gif) 46 | 47 | ## Inspiration 48 | 49 | 动画制作有着悠久的历史。我写过一篇文章 [Principles of Animation for the Web](https://cssanimation.rocks/principles/)。文章里的很多内容取材于迪士尼1981年出版的书 [The Illusion of Life: Disney Animation](https://en.wikipedia.org/wiki/12_basic_principles_of_animation). 50 | 51 | 如果你想更深入了解,可以查看 youtube 上的 [Animator's Survival Kit videos](https://www.youtube.com/watch?v=loCiTO8qEMI)。 52 | 53 | 有个网站推荐给大家 [Hover States](https://hoverstat.es/),上面有很多关于网页动画的例子。[Dribbble.com](https://dribbble.com/) 也很不错。 54 | 55 | 比如 Dribbble 上有展示 [Google's Material Design principles](https://dribbble.com/shots/1621920-Google-Material-Design-Free-AE-Project-File)的例子。在搜索栏出入 animation 查看更多信息。 56 | 57 | 大家也可以多关注下 [CodePen](https://codepen.io/),上面有很多很棒的 canvas 和网页动画的例子。 58 | 59 | ## Summary 60 | 61 | + 动画很重要。 62 | + 用对了会让我们网站的体验更好。 63 | + 它会吸引用户,从而更有效地传递信息。 64 | + 但是千万不要滥用它,否则得不偿失。 65 | + 如果想提高自己的水平,那就好好学一学,用一用。 66 | 67 | ## Homework 68 | 69 | 试着在工作中使用 `animation` 吧。 70 | 71 | 我们不能让所有的东西都”动起来“,但可以在一些关键的地方添加一些合理精致的小动画,让用户更好的使用我们的网站和服务。想一想,是不是有些需要操作的地方没有引起用户的注意?是不是有些内容的变化太突兀,太生硬?如果有,那就可以考虑使用 `animation` 来优化。 72 | 73 | 多去一些设计网站([Hover States](https://hoverstat.es/)、[Little Big Details](http://littlebigdetails.com/)、[Dribbble](https://dribbble.com/))看看,会给你带来不少的启发呢。 74 | -------------------------------------------------------------------------------- /chapters/01/03.md: -------------------------------------------------------------------------------- 1 | # Creative environments 2 | 3 | > "You don't learn to walk by following rules. You learn by doing, and by falling over." 4 | > Richard Branson 5 | 6 | 现在我们来看看如何在浏览器中构建和查看CSS animations。 在开始敲代码之前,我们先来创建一套工作流。 7 | 8 | 我们将介绍两种方法:在浏览器中(线上)开发和离线(本地)开发。 9 | 10 | ## In the browser 11 | 12 | 最简单的就是直接在线上开发然后看效果。我经常使用的是[CodePen](Codepen.io),还有一个叫[JS Fiddle](http://jsfiddle.net/)。 13 | 14 | 在本课程中,我将使用[CodePen](http://codepen.io)编写示例,所以大家有必要熟悉下它的使用。 15 | 16 | CodePen是一个在线写代码的平台,你可以在上面编写 HTML、CSS 和 JavaScript ,然后立刻就能看到结果。屏幕被分成四个区域,分别是结果预览区,HTML,CSS 和 JavaScript编辑区。每个区域中都有一个设置选项可以进行不同的设置,比如设置用 Sass 代替 CSS。 17 | 18 | ## Local development 19 | 20 | 对于复杂的项目,我更喜欢在本地开发。 21 | 22 | ### Basic option: Simple HTML/CSS 23 | 24 | 最简单直接的就是创建一个 HTML 文件(filename.html)和一个 CSS 文件(filename.css),然后在 HTML 文件中链接 CSS 文件。这种方法虽然简单,但是写的时候要不断的在浏览器和编辑器直接来回切换,很麻烦。 25 | 26 | 27 | 我已经创建了一组基本的 HTML 和 CSS 文件,大家可以下载使用,下载地址:[https://github.com/cssanimation/starter/archive/master.zip](https://github.com/cssanimation/starter/archive/master.zip)。 28 | 29 | ![Starting files](images/files.jpg) 30 | 31 | ### Dreamweaver / Macaw / Muse / Coda / Sublime 32 | 33 | 编辑器方面你可以选择任何一个你喜欢的用,这无所谓的。有一些编辑器可以对动效进行可视化编辑,如果你想用,也没问题的。 34 | 35 | 就我个人而言,我还是建议你自己去敲这些代码。这样子会加深对 CSS 的理解,以后遇到问题解决起来也容易,写复杂动效的时候也会更顺手。 36 | 37 | ### Gulp 38 | 39 | 如果你熟悉 Github、Node,你会想在自己的电脑上搭建一套开发的脚手架。 40 | 41 | Gulp 是以 Node 为基础,它的处理速度非常快。 42 | 43 | 它可以将 Sass 编译成 CSS ,自动添加浏览器前缀,同步浏览器渲染(这样你就不需要每次更新代码后要刷新浏览器再看效果了)。 44 | 45 | 如果你使用过Grunt或其他构建工具,你就会发现过程很类似。 46 | 47 | 我已经创建了一个[Github库](https://github.com/cssanimation/gulp-sass-starter)。如果你习惯使用Git,你可以去下载然后根据[readme文档](https://github.com/cssanimation/gulp-sass-starter/blob/master/README.md)来进行配置。 48 | 49 | 50 | 如果愿意,大家可以一起改进它,欢迎 pull request。 51 | 52 | ## In summary 53 | 54 | 在学习 CSS 动画的时候,你可以尝试上面提到的不同的方法。你可以自己搭建环境,也可以使用[CodePen](http://codepen.io),都可以。 55 | 56 | ## Homework 57 | 58 | 注册[CodePen](http://codepen.io),然后尝试添加一些HTML和CSS来看一下效果。 也可以在首页上查看流行的CodePens。 59 | 60 | _Optional:_:如果你想本地开发,请下载下面的文件: 61 | 62 | 63 | * 必需: [Project starter HTML/CSS files](https://github.com/cssanimation/starter/archive/master.zip) 64 | * 高级: [Gulp & Sass starter](https://github.com/cssanimation/gulp-sass-starter) 65 | 66 | **下一篇:** 我们将学习 transitions! 67 | -------------------------------------------------------------------------------- /chapters/01/04.md: -------------------------------------------------------------------------------- 1 | # Transitions 2 | 3 | 我们来看下 `transition` 这个属性。 4 | 5 | 以前的浏览器功能比较简单,那时候无法显示图片,也只能处理一部分字体的渲染。后来出现了 CSS ,它的出现给网页带来了无限的可能。 6 | 7 | 在浏览器上进行动画制作也不是什么新鲜事了,Flash,Canvas 还有 JavaScript 都可以进行制作动画。现在我们又有了新选择:CSS。 8 | 9 | ## Transitions 10 | 11 | 使用 CSS 制作动画的一种方式就是使用 `transition` 属性。啥是 `transition` ? `transition` 指从一个“状态”到另一个“状态”的动画模拟。 12 | 13 | ![Transitions: A to B](images/ab.png) 14 | 15 | 当我们告诉浏览器,我们想在某个元素上使用 transition 时,就是让浏览器在状态的变化过程中对属性的值进行自动插值。 16 | 17 | ![Animated transition from A to B (http://codepen.io/donovanh/pen/RNdxqw)](images/ab_animated.png) 18 | 19 | 举个例子,我们可以在一个元素鼠标悬停的时候,使用过渡(transition)来改变元素的样式,让浏览器产生从起始状态到终止状态的平滑的过渡效果。 20 | 21 | ![Animated button (http://codepen.io/donovanh/pen/MYQdZd)](images/button.png) 22 | 23 | ## Transition properties 24 | 25 | 我们可以在元素的很多属性上创建过渡效果。我们可以控制过渡的快慢,延迟,还可以用 `timing function` 控制过渡具体的变化速度。来看几个例子。 26 | 27 | ![Combining transitions (http://in-ni.com/)](images/winnie-min.gif) 28 | 29 | ![More transitions (http://codepen.io/suez/pen/XJGOyL)](images/transitions-min.gif) 30 | 31 | ## In summary 32 | 33 | `transition` 是指从一个状态到另一个状态的变化。比如当鼠标在某个元素上悬停时,我们会修改它的样式,采用 `transition` 可以创建一个平滑的动画效果。 34 | -------------------------------------------------------------------------------- /chapters/01/05.md: -------------------------------------------------------------------------------- 1 | # Animations 2 | 3 | 目前为止,我们讨论了为什么需要动画,介绍了一些激发灵感的资源,也介绍了一些对开发有帮助的工具和网站,并且简单了解了过渡的概念。 4 | 5 | 下一步,让我来介绍一下 `animation` 属性。 6 | 7 | ## Animation in the browser 8 | 9 | 过渡(transition)和动画(animation)是相似的。两者都是 CSS 的属性,并且都可以通过持续时间(duration),延迟(delay)以及其他属性控制浏览器制作动画效果。 10 | 11 | 当然也有不同,过渡指从一个状态到另一个状态的平滑的变化过程,而动画可以是多个“状态”间的变化。 12 | 13 | ![Transitions: A to B](images/ab-min.gif) 14 | 15 | ![Animations: A to B to C](images/abc.png) 16 | 17 | 动画更适合相对复杂的场景。上面的例子中有三种状态(A,B,C)。transition 只会从A开始一直到C结束,而 animation 允许我们添加状态B,并且从A到B再到C经历完整的3个状态。 18 | 19 | 动画还有一点不同,它可以自动开始。过渡一般需要通过添加样式类或更改状态(如悬停)来触发,但动画可以在页面加载时自动启动。 20 | 21 | ## Examples 22 | 23 | Codepen 的“Save”按钮就是一个很好的例子。它能很好的让人们注意到这个按钮。 24 | 25 | ![Save Button on CodePen](images/save_button-min.gif) 26 | 27 | 该效果是由一系列的`keyframes`组成,它们将告诉浏览器从左到右如何去摆动按钮。后面我们会深入研究 keyframes。 28 | 29 | 另一个示例是来自 Twitter 的 app 构建平台[Fabric](https://get.fabric.io/) 30 | 31 | ![Fabric hero image animation](images/fabric-min.gif) 32 | 33 | 最后,是我去年做的一个例子,这是一个 CSS Mac Plus,用来在网上 [theWeb.is teaser site](http://theweb.is/) 展示欢迎信息。 34 | 35 | ![Mac Plus created using CSS](images/macplus-min.gif) 36 | 37 | CSS Mac Plus 可以在 [CodePen](https://codepen.io/donovanh/full/HGqjp/) 上面看到,[这里](https://cssanimation.rocks/macplus/)是关于如何实现的指导。 38 | 39 | ## Transitions vs. Animations 40 | 41 | transition 是指从一种状态到另一种状态(A 到 B)的变化,通常是由某种“动作”触发,比如鼠标悬停,或者用 JavaScript 添加或删除样式类。 42 | 43 | animation 更加复杂一些,它允许你按照实际需求添加很多的 keyframes 来创建动画。它可以自动触发,并且可以循环。 44 | 45 | ![Transition vs Animation](images/transitions-animations-min.gif) 46 | 47 | 后面我们会学习 animation 属性。多去找一些实际的应用例子,如果有不错的例子,记得[告诉我](mailto:donovan@cssanimation.rocks)! 48 | 49 | ## Homework 50 | 51 | 浏览网页时要多多留意动画。当某物以某种方式移动以引起你的注意的时候,这通常就是一个 animation。 52 | 53 | 如果你已经下载 HTML 和 CSS 的脚手架,找到 animation 看一下,与 transition 不同,animation 还需要第二部分,称之为 keyframe。试着改变其中的一些值,看看会产生什么效果。 54 | -------------------------------------------------------------------------------- /chapters/02/01.md: -------------------------------------------------------------------------------- 1 | # Transitions in action 2 | 3 | 前面我们介绍了 `transition` 和 `animation` 这两个属性,这一节我们来看看具体的代码。 4 | 5 | ## Transitions 6 | 7 | 在浏览器中,一个元素从一个状态转变成另一个状态,我们称发生了过渡(transition)。浏览器负责来渲染状态变化过程中的每一帧从而创建一个动画效果。 8 | 9 | `transition` 是 CSS 中的属性,就像给元素设置 `height`、`width`、`border` 一样,我们也可以给元素设置 `transition`。 10 | 11 | 那 `transition` 怎么用呢?来看下面代码: 12 | 13 | ```css 14 | transition: background 0.5s linear; 15 | ``` 16 | 17 | 在上面的代码中,我们告诉浏览器,我们希望在 0.5 秒的时间里,按照 `linear` 的时间函数([timing-function](https://developer.mozilla.org/zh-CN/docs/Web/CSS/timing-function))来改变某个元素的 `background` 属性。 18 | 19 | 下面结合具体的例子来看一下:我们希望当鼠标在按钮上悬停时(`hover`)改变按钮的 `background`。 20 | 21 | ```css 22 | button { 23 | background: white; 24 | transition: background 0.5s linear; 25 | } 26 | 27 | button:hover { 28 | background: green; 29 | } 30 | ``` 31 | 32 | 这里有一点要注意,`transition` 属性的位置要放到 `button` 中。这样会告诉浏览器,不光按钮从初始状态**变成**悬停(`hover`)的时候要添加过渡效果,当从悬停状态**变回**初始状态时也要添加过渡效果。 33 | 34 | 如果我们把 `transition: background 0.5s linear;` 这句放到下面 `button:hover` 里,那么当按钮从初始状态变成悬停状态时会有过渡效果,但当从悬停变回初始状态时,就立刻改变了 `background`,而没有过渡的效果。 35 | 36 | ## Example: Button transition 37 | 38 | ![](images/button-min.gif) 39 | 40 | [你可以查看 CodePen 上的代码,并尝试修改代码来体会不同的效果。](http://codepen.io/donovanh/pen/MYQdZd) 41 | 42 | 请注意 CodePen 代码里以 `transition-` 开头的属性。这里用了全写的方式。 43 | 44 | ```css 45 | transition-property: all; 46 | transition-duration: 0.4s; 47 | transition-timing-function: ease-out; 48 | ``` 49 | 50 | 上面的代码的意思希望浏览器在**0.4s**的时间里改变**all**所有的属性,包括 `colours, size, position` 等。 51 | 52 | 可以将 `transition-timing-function` 设置成下面的贝塞尔曲线函数形式,试试效果会发生什么改变。 53 | 54 | ```css 55 | transition-timing-function: cubic-bezier(0.59, -0.26, 0.33, 1.42); 56 | ``` 57 | 58 | ## Prefixes and browser compatibility 59 | 60 | 上面的代码,为了书写和阅读的方便,都没有添加浏览器前缀,如果要发布正式版,请在属性前加上对应的浏览器前缀。 61 | 62 | 可以使用 `Autoprefixer`(Codepen 上 css 设置的一个自动添加选项),或者手动添加。 63 | 64 | ``` 65 | -webkit-transition: ...; 66 | -moz-transition: ...; 67 | transition: ...; 68 | ``` 69 | 70 | ## Homework 71 | 72 | 大家可以试着修改上面的代码来看看会有什么效果。 73 | 74 | 这有一个好玩的例子,你可以试一下:[awesome hover style](http://codepen.io/nxtonic/pen/gbZNKJ) 75 | -------------------------------------------------------------------------------- /chapters/02/02.md: -------------------------------------------------------------------------------- 1 | # Transitions properties 2 | 3 | 前面我们简单介绍 `transition`,下面我们来具体的看下它有哪些属性和对应的含义。 4 | 5 | ## Shorthand vs Longhand 6 | 7 | 在写 CSS 样式的时候我们经常将多个属性写成简写( `Shorthand` )的形式。比如设置元素的 `padding` 值我们就可以这么写: 8 | 9 | ```css 10 | padding: 10px 20px 15px 25px; 11 | ``` 12 | 13 | 上面和下面的代码是等价的: 14 | 15 | ```css 16 | padding-top: 10px; 17 | padding-right: 20px; 18 | padding-bottom: 15px; 19 | padding-left: 25px; 20 | ``` 21 | 22 | 同理,`transition` 也有其简写形式: 23 | 24 | ```css 25 | transition: all 0.5s 1s linear; 26 | ``` 27 | 28 | `transition` 的简写形式对应各属性含义如下: 29 | 30 | ``` 31 | transition: [property] [duration] [delay] [timing-function]; 32 | ``` 33 | 34 | 上面的例子中,各属性也可以单独写:: 35 | 36 | ```css 37 | transition-property: all; 38 | transition-duration: 0.5s; 39 | transition-delay: 1s; 40 | transition-timing-function: linear; 41 | ``` 42 | 43 | 让我们来看下各个属性具体的含义。 44 | 45 | ### transition-property 46 | 47 | 通常是简写形式的第一个属性,规定应用过渡的 CSS 属性的名称。比如要修改 `background` ,就可以在这里写 `background` 。也可以使用 `all` ,所有适用的CSS过渡的属性上创建过渡效果(不是所有的属性都可以创建过渡效果的)。 48 | 49 | ### transition-duration 50 | 51 | `transition-duration` 表示过渡效果的持续时间。`transition-duration` 设置成`3s`的持续时间是指设置`3`倍的`1000ms`。 52 | 53 | ### transition-delay 54 | 55 | `transition-delay` 表示过渡效果的延迟时间(效果开始前的等待时间),单位可以是秒或者毫秒。`3s` 表示3秒,`100ms`表示100毫秒,也可以写成`0.1s`。 56 | 57 | ### transition-timing-function 58 | 59 | `transition` 和 `animation` 都会使用时间函数(`timing function`),时间函数有很多可选值,这里就不一一列举了,后续会详细说明。 60 | 61 | ## Things transitions _don't_ work on 62 | 63 | 过渡效果(`transition`)可以应用在很多的属性上,比如 `position`,`size`,`colour`,`border`,`background-position`,但有些属性是不能应用过渡的,比如 `font-family`。 64 | 65 | 用CSS创建的背景图像(例如渐变效果),不能对其属性使用动画。这意味着浏览器用每帧动画重新创建背景图像,因此不支持。 66 | 67 | 不过你**可以**在 `opacity` 和 `background-position`上使用过渡。通过移动背景图(`background images`)或者隐藏背景图可以创建很丰富的效果。 68 | 69 | 举个栗子说明下:[Baymax example](http://cssanimation.rocks/baymax/) 。 70 | 71 | ![Source: http://cssanimation.rocks/baymax/](images/baymax-min.gif) 72 | 73 | 再来一个:[button sheen effect](https://cssanimation.rocks/pseudo-elements/) 74 | 75 | ![Source: https://cssanimation.rocks/pseudo-elements/](images/sheen-min.gif) 76 | 77 | ## Homework 78 | 79 | 我创建了一个简单的 `transtion` 效果([Codepen](http://codepen.io/donovanh/pen/NPYNGa?editors=110)),你可以尝试修改不同的属性来创造不同的效果。 80 | -------------------------------------------------------------------------------- /chapters/02/03.md: -------------------------------------------------------------------------------- 1 | # Timing functions 2 | 3 | 时间函数(`timing function`)是用来描述过渡过程中,属性值变化速度的。如果过渡过程中属性值一直以一个固定的速度变化,那就会显得千篇一律,不那么生动。有了时间函数(timing function)的加持,我们可以制作更加生动有趣的效果。 4 | 5 | 举个例子: 6 | 7 | 第一个例子,我们使用 `linear`: 8 | 9 | ![Linear transition](images/linear-min.gif) 10 | 11 | 第二个例子,我们使用 `cubic-bezier`: 12 | 13 | ![Cubic-bezier timing function](images/demo-min.gif) 14 | 15 | 通过 `cubic-bezier`,我们让边框开始时先往里缩一下,然后再开始改变。结束的时候先变大一点然后再缩回到正确的大小。 16 | 17 | 下面我们来具体看下 `timing-function` 18 | 19 | 我在[CodePen](http://codepen.io/donovanh/pen/GgaRNv)上写了一个例子,大家可以一边看,一边修改例子来查看效果。 20 | 21 | ## Linear 22 | 23 | ![Linear](images/linear-example-min.gif) 24 | 25 | `linear` 表示属性值按照一个固定的速度线性的变化,中间不会有突变,所以不会出现加快或减慢的状态。非常适合速度不变的场景下使用,比如车窗外不断飞过的风景或者一直旋转的月亮。 26 | 27 | ## Ease-in 28 | 29 | ![Ease-in](images/ease-in-min.gif) 30 | 31 | `ease-in` 表示属性值先以较慢速度变化,然后速度越来越快,就好比一个球从高处落下,一开始下降的速度很慢,然后越来越快。 32 | 33 | ## Ease-out 34 | 35 | ![Ease-out](images/ease-out-min.gif) 36 | 37 | `ease-out` 刚好跟 `ease-in` 相反,一开始速度快,然后速度越来越慢。最适合元素从屏外进入屏内进行显示的情况。 38 | 39 | ## Ease-in-out 40 | 41 | ![Ease-in-out](images/ease-in-out-min.gif) 42 | 43 | `ease-in-out` 是上面两个的合成,一开始慢,然后变快,然后又变慢。做加载的效果时用这个时间函数效果会很不错。 44 | 45 | ## Cubic-bezier 46 | 47 | ![Cubic-bezier (custom)](images/cubic-bezier-min.gif) 48 | 49 | 上面所讲的时间函数本质上都是贝塞尔曲线。利用 `cubic-bezier` 我们可以自定义具体的变化曲线。 50 | 51 | `cubic-bezier` 有4个参数,代表两个控制点的坐标。 52 | 53 | ``` 54 | transition-timing-function: cubic-bezier(1,-0.49,.13,1.09); 55 | ``` 56 | 57 | 两个控制点坐标为 `(1, -0.49)` 和 `(.13, 1.09)`,画个坐标系来看一下: 58 | 59 | ![Source: http://cubic-bezier.com/#1,-0.49,.13,1.09](images/cubic-bezier-graph.png) 60 | 61 | 有个在线工具[cubic-bezier.com](http://cubic-bezier.com)可以实时看到通过拖动控制点生成不同的曲线。 62 | 63 | 把控制点坐标设置大于1,看看会有啥效果。:) 64 | 65 | ## Steps 66 | 67 | ![Steps](images/steps-min.gif) 68 | 69 | 目前为止讲过的时间函数(速度的变化)都是连续的曲线,`steps` 可以将过渡时间分成大小相等的时间时隔来运行。比如使用 `steps(4)`,效果就会变成如上图那样不连续的效果。 70 | 71 | ![](images/steps.png) 72 | 73 | 这适合做精灵动画(`sprite animation`)。比如一个精灵动画有4帧,设置`steps`,就可以通过改变`background position` 来创建动画了。 74 | 75 | 举个栗子:[Twitter fave button](https://cssanimation.rocks/twitter-fave/) 76 | 77 | You can also specify whether the transition holds the first frame for the fragment of the duration or whether it holds the final frame. The default is `end`, as this assumes that the first frame in the sprite is already showing before the animation begins. 78 | 79 | `steps`有两个参数,第二个参数默认值是`end`。`start` 表示要过渡的属性值会在开始时就立马变成第一个步进点(`this first step`)对应的属性值,并保持一个步进的时间(`step duration`),而 `end` 表示要过渡的属性值在开始的时候并不会立马改变,而是在保持一个步进时间之后,变成第一个步进点的属性值。【Tips: 按照原文翻译有点不好翻,就用自己的理解写了下。】 80 | 81 | 可以按下面的形式去指定 `end` 还是 `start`。 82 | 83 | ```css 84 | transition: all 2s steps(10, start); 85 | transition: all 2s steps(10, end); 86 | ``` 87 | 88 | ## More examples 89 | 90 | 有关 `timing function` 的更多问题,我已经在[medium](https://medium.com/css-tutorials/bouncy-transitions-c0c8085d489)上写了一篇文章可供参考。 91 | 92 | ## Homework 93 | 94 | 尝试修改上节的[例子](http://codepen.io/donovanh/pen/NPYNGa?editors=110),修改 `transition-timing-function` 属性来查看不同值的不同效果。 95 | 96 | 这里还有一个[例子](http://codepen.io/donovanh/pen/GgaRNv),虽然这个例子使用的是 `animation`,但它里面 `timing function` 的使用是跟 `transition` 一样的。 97 | -------------------------------------------------------------------------------- /chapters/02/04.md: -------------------------------------------------------------------------------- 1 | # Multiple transitions 2 | 3 | 到目前为止,我们都是一次在元素上使用 `transition` 修改一个属性值,接下来我们将看一些复杂的例子:如何使用一个 `transition` 来修改很多属性,如何使用多个 `transition` 来创造更好的效果。【Tips:使用多个 `transition` 并不是像下面那样写多个 `transition`。要在一个元素上使用多种过渡,可以在一个 `transtion` 里写,具体看本节末尾处的说明】 4 | 5 | ```css 6 | // 错误的例子。并不是预想的 width 和 background 同时添加过渡效果。 7 | transition: width 1s ease-in-out; 8 | transition: background 1s ease-out; 9 | ``` 10 | 11 | ## Example 1: Fancy button 12 | 13 | 前面我们提到的 `button` 的例子比较简单,这里我们来看个复杂的例子。 14 | 15 | ![Source: http://codepen.io/donovanh/pen/YPMGpJ](images/multiple-button-min.gif) 16 | 17 | 在这个[例子](http://codepen.io/donovanh/pen/YPMGpJ)里我们创造了一个比较复杂的 `hover` 效果,但我们其实关键的样式只有一句话: 18 | 19 | ```css 20 | transition: transform 0.4s cubic-bezier(0.72, -0.61, 0.25, 1.51); 21 | ``` 22 | 23 | 接下来我们分析下这个效果是怎么做的。 24 | 25 | 本例中的按钮由两个 icon 和两个 text 组成。初始状态(鼠标未悬停)显示 follow me 和 twitter 的 icon,@ 标志和 cssanimation 不显示。 26 | 27 | ![](images/button-element-positioning.png) 28 | 29 | 当鼠标悬停时再显示 @ 标志和 cssanimation 文本。 30 | 31 | ![](images/button-element-positioning2.png) 32 | 33 | 我们使用 CSS 中的 `transform` 来实现上面的显示和隐藏。对 twitter icon 进行绝对定位,设置其 `left` 和 `top` 34 | 35 | ```css 36 | .icon { 37 | position: absolute; 38 | left: 0.75em; 39 | top: 0.75em; 40 | } 41 | ``` 42 | 43 | 鼠标悬停时添加 `transform` 属性将其移出 button。在外层的容器上添加`overflow: hidden` 就可以将 twitter icon 隐藏了。 44 | 45 | ```css 46 | a:hover .icon { 47 | transform: translateY(3em); 48 | } 49 | ``` 50 | 51 | 如果不添加 `transition`,元素就会突然消失,效果并不好。在这个例子里,button 里的元素都是 span,所以可以写一条 `transition` 然后应用到所有的 span 上。span 的状态发生变化时都会使用这条 `transition`。 52 | 53 | ```css 54 | span { 55 | transition: transform 0.4s cubic-bezier(0.72, -0.61, 0.25, 1.51); 56 | } 57 | ``` 58 | 59 | [CodePen 链接](http://codepen.io/donovanh/pen/YPMGpJ) 60 | 61 | ## Example 2: Background reveal 62 | 63 | 再看一个例子。在本例中,当鼠标在卡片上悬停时,下方会显示文字。 64 | 65 | ![Source: http://codepen.io/donovanh/pen/LEvjJg](images/cat-min.gif) 66 | 67 | 分析下这个效果:初始时其实 text 也是显示的,只不过设置了 `opacity` 为0,让它变得透明,所以看不见。鼠标悬停时,把 `opacity` 改为1,同时修改文本外层容器的高度。【Tips:初始时外层的 `info` 容器设置了 `overflow:hidden`, 同时对文本设置了 `transform`, 将其从可视区域移出去,并且设置其 `opacity` 为0,所以文字就被隐藏了】 68 | 69 | 如果不添加 `transition`,文字的出现就会显得很突兀,可以看下效果对比下。[CodePen链接](http://codepen.io/donovanh/pen/PwgKLw?editors=110) 70 | 71 | 我们把所有的 `transition` 整合到一起,就有了如图的效果。[链接](http://codepen.io/donovanh/pen/LEvjJg) 72 | 73 | 这里我们用了两个 `transiton` 语句。 74 | 75 | 第一条告诉浏览器在0.5s的时间里,在所有可以添加过渡效果的属性上应用过渡效果。效果的变化速度用 `cubic-bezier(.48,-0.28,.41,1.4)` 来设定。在本例中用这句来改变了文本外层容器的高度。 76 | 77 | ```css 78 | transition: all 0.5s cubic-bezier(0.48, -0.28, 0.41, 1.4); 79 | ``` 80 | 81 | 第二条让文本移动了。 82 | 83 | ```css 84 | transition: all 0.4s ease-out; 85 | ``` 86 | 87 | 鼠标悬停时我们可以做很多事,比如本例中我们改变了 `info` 这个 `div` 元素的高度,还改变了 `p` 元素的位置。 88 | 89 | 本例中我们对不同的元素添加了不同的过渡,在实际工程中这样子做会给页面效果增色不少的。 90 | 91 | ## Multiple transitions on a single element 92 | 93 | 我们不光可以在多个元素上使用多个 `transition`,我们还可以在一个元素上使用多个 `transtion`。 94 | 95 | 比如有一个元素,我们希望它的背景和边框有不同的过渡效果,显然对所有的属性写一条单一的 `transition` 不能满足我们的需求。【Tips:比如希望背景的过渡持续时间和时间函数跟边框的不一样,那么 `transition: all 1s linear` 这样子显然是无法满足需求的。】 96 | 97 | 我们可以在一条 `transition` 语句里设置多个属性,语句间用 `,` 分开。 98 | 99 | ```css 100 | transition: background 1s ease-out, border 0.5s linear; 101 | ``` 102 | 103 | 上面的 `transition` 应用到某个元素上后,元素的 `background` 会和 `border` 采用不同的过渡效果。`background` 过渡持续时间1s,时间函数 `ease-out`,`border` 的过渡持续时间0.5s,时间函数是 `linear`。 104 | -------------------------------------------------------------------------------- /chapters/02/05.md: -------------------------------------------------------------------------------- 1 | # Transitions and JavaScript 2 | 3 | 到目前为止,前面我们举过的例子,都是使用 CSS 中的 `transition` 在鼠标悬停时和不悬停时添加过渡效果。 4 | 5 | 这些效果都需要被动地触发,就是要鼠标悬停在元素上或者从元素上移开。当然这不是触发这些效果的唯一方式,我们还可以使用 `JavaScript` 代码来触发这些效果。 6 | 7 | ## Add or remove classes 8 | 9 | `transition` 的作用就是在两个状态之间创建平滑的变化效果,不至于显得太突兀。既然是两个状态,那我们可以把这两个状态用不同的 `class` 来对应,然后通过 `javascript` 来控制添加和删除这些 `class`,从而触发效果。 10 | 11 | 看下面的例子,具体代码可见[CodePen](http://codepen.io/donovanh/pen/YPbxqa)。 12 | 13 | ![Source: http://codepen.io/donovanh/pen/YPbxqa](images/js-triggered-button-min.gif) 14 | 15 | ```html 16 | 17 |
18 |

Some hidden content

19 |

Pressing the button shows this content. Nice!

20 |
21 | ``` 22 | 23 | 在这个例子中,页面结构主要有一个 `button` 和一个 `div` 容器。 24 | 25 | ```css 26 | .hide { 27 | opacity: 0; 28 | top: calc(50% + 8em); 29 | } 30 | .show { 31 | opacity: 1; 32 | top: calc(50% + 6em); 33 | } 34 | ``` 35 | 36 | 初始时给容器添加了一个类名是 `hide`,设置其 `opacity` 为0,视觉上就不显示了。样式表里还有要给 `show`,设置 `opacity` 为1,为可见状态。 37 | 38 | 更复杂的例子可以看这篇文章[Adding Appeal to Your Animations on the Web](http://webdesign.tutsplus.com/tutorials/adding-appeal-to-your-animations-on-the-web--cms-23649)。 39 | 40 | 在本教程的末尾我们还会学习怎么在滚动时触发 `transition` 和 `animation` 来改变样式。 41 | 42 | ## Controlling transitions with JavaScript 43 | 44 | 除了像上面那样给元素添加或者移除 CSS 类名,我们还可以像下面这样直接用 `javascript` 修改 CSS 属性。 45 | 46 | ```javascript 47 | element.style.transition = 'opacity 1s ease-out'; 48 | ``` 49 | 50 | 实际应用里,假设我们有个 ID 是 `js-show` 的元素,我们可以这样设置: 51 | 52 | ```javascript 53 | document.getElementById('js-show').style.transition = 'opacity 1s ease-out'; 54 | ``` 55 | 56 | 值得注意的是,如果采用上述方式去设置 `transition`,那要带上**浏览器前缀**: 57 | 58 | ```javascript 59 | document.getElementById('js-show').style.webkitTransition = 'opacity 1s ease-out'; 60 | document.getElementById('js-show').style.transition = 'opacity 1s ease-out'; 61 | ``` 62 | 63 | ## Let's recap 64 | 65 | 这一章我们系统地介绍了 `transition`,包括它的几个属性分值(`duration`,`delay`,`timing function`),还介绍了如何组合使用多个 `transition` 来创造复杂的效果,最后我们还尝试了用 `javascript` 直接控制 `transition`。 66 | 67 | 下一章我们将讨论 `animation` 这个话题。 68 | 69 | ## Homework 70 | 71 | Before we start looking at the `animation` property, take some time to think about how you use transitions. 72 | 73 | Can you think of ways they could help smooth the interactions or state changes on your pages? How might they add appeal? 74 | -------------------------------------------------------------------------------- /chapters/03/01.md: -------------------------------------------------------------------------------- 1 | # Animations in action 2 | 3 | 前面我们讲了 `transition` 属性,现在让我们来学习下 `animation` 属性 4 | 5 | ![](images/abc.png) 6 | 7 | ## A symbiotic relationship 8 | 9 | 给元素添加 `animation` 跟添加 `transition`类似。不过它还需要 `keyframes` 。 10 | 11 | .element { 12 | animation: ... 13 | } 14 | 15 | @keyframes animation-name { 16 | /* Keyframes go here */ 17 | } 18 | 19 | 单独定义 `keyframes` 的好处是我们可以复用这些动画。 20 | 21 | ## The `animation` property 22 | 23 | 我们通过 `animation` 属性可以将编写的 keyframes 应用到元素上。`animation` 和 `transition` 很类似,不过多了一些其他的选项。下面是 `animation` 的简写方式: 24 | 25 | animation: change-background 4s linear infinite; 26 | 27 | 分开写就是下面这样: 28 | 29 | animation-name: change-background; 30 | animation-duration: 4s; 31 | animation-timing-function: linear; 32 | animation-repeat: infinite; 33 | 34 | `transition` 需要指定一个目标属性,例如 "background" 或 "all",`animation` 则需要带 `keyframes` 的名字来描述动画。 35 | 36 | animation 拥有一些 transition 没有的属性。例如,我们可以告诉动画来回交替循环,而不是每次从头开始循环。 37 | 38 | ## Keyframes 39 | 40 | `keyframes` 是用来描述动画过程中一系列变化的。 41 | 42 | 我们用一个简单的例子来说明下:在网页上有一个 `div` 标签,它的背景颜色不断地在变,像下面图中显示的那样。 43 | 44 | ![](images/change-background-min.gif) 45 | 46 | 怎样描述这种变化呢?我们可以说“开始时蓝色,到一半时变成橙色,最后变成绿色” 47 | 48 | 如果再精确一点描述,我们可以用百分比来描述: 49 | 50 | “0%的时候蓝色背景,50%的时候橙色,100%的时候绿色” 51 | 52 | 我们可以概括为: 53 | 54 | 0% Blue 55 | 50% Green 56 | 100% Orange 57 | 58 | 这样子我们就创建了动画整个过程中包含的“路径点”(waypoint)。 现在要做的就是将这些百分比按照 `keyframes` 的规则去写并命名。 结果如下: 59 | 60 | @keyframes change-background { 61 | 0% { 62 | background: blue; 63 | } 64 | 50% { 65 | background: orange; 66 | } 67 | 100% { 68 | background: green; 69 | } 70 | } 71 | 72 | 这个动画名字叫 “change-background”。稍后我们会用到它。 73 | 74 | 结合下面的例子,我们可以看出,上面的百分比指的是在动画过程中,其对应的 keyframe 发生的“时间点”。还可以知道,我们只要告诉浏览器开始、中间和结束时的颜色就可以了,在这些状态之间变化时,浏览器会自动去计算颜色值的插值。 75 | 76 | ![Source: http://codepen.io/donovanh/pen/WbqNwd?editors=110](images/simple-keyframes-min.gif) 77 | 78 | [CodePen 链接](http://codepen.io/donovanh/pen/WbqNwd?editors=110) 79 | 80 | 前面提到过,使用 animation-direction 可以让动画来回交替变化,看下面的例子,直观地感受下: 81 | 82 | ![](images/simple-keyframes-alternating-min.gif) 83 | 84 | 代码放到[CodePen](http://codepen.io/donovanh/pen/NPZqej)上了。 animation-direction 属性已经更改为 alternate 85 | 86 | ## Prefixes 87 | 88 | 虽然我写的代码里没有加 -webkit- 等前缀,但如果要在实际工程里应用 animation,还是要添加对应的浏览器前缀。 89 | 90 | 在 CodePen 中,你可以使用 CSS 设置中的 “Autoprefixer” 选项。对于本地开发,我使用 Gulp 版本的 Autoprefixer。 [Prefix Free](http://leaverou.github.io/prefixfree/)也是一个不错的选择。 91 | 92 | ## Homework 93 | 94 | Open up [this keyframes example](http://codepen.io/donovanh/pen/WbqNwd?editors=110) and try changing the code. See if you can break it, and fix it. Even better, if you come up with something cool, let me know! 95 | 96 | I love seeing how you're getting on. You can [email me](mailto:donovan@cssanimation.rocks) or get in touch [on Twitter](https://twitter.com/donovanh). 97 | -------------------------------------------------------------------------------- /chapters/03/02.md: -------------------------------------------------------------------------------- 1 | # Animation properties 2 | 3 | 在我们看更多的例子之前,先来了解下 `animation` 的各个属性。 4 | 5 | 与 `transition` 一样,`animation` 可以使用简写形式,也可以分开单独指定属性值。 6 | 7 | ### animation-delay 8 | 9 | 与 `transition-delay` 类似,此属性表示在开始之前动画的等待时间。在定义多个动画的情况下特别有用。 10 | 11 | 如果定义的动画是不断循环的,在这种情况下,delay 属性并不会每次循环都有效,只有在给元素添加上动画效果的时候才有效。(只有第一次循环前会有等待时间,其余的就没有了) 12 | 13 | 实际上可以给这个属性一个负值,比如`-1s`。动画会直接从第1s开始执行,就好像这1s时间已经过去了。 14 | 15 | ### animation-direction 16 | 17 | 动画通常从 0% 开始,到 100% 结束。`animation-direction` 使用 `normal`,`reverse`,`alternate` 和 `alternate-reverse` 来控制动画变化的方向。(从开始到结束我们可以看作是一个有向的变化) 18 | 19 | “Reverse”是指从 100% 播放(或循环)到 0%,而 “alternate” 指动画轮流反复播放,即从 0% 播放到 100% 然后再播放到 0%。 20 | 21 | ### animation-duration 22 | 23 | 动画完成一个周期所需要的时间。类似于 `transition-duration`,以秒或毫秒计,如`1s`、`200ms`。 24 | 25 | ### animation-fill-mode 26 | 27 | 默认情况下,动画播放完成元素返回其正常状态。使用 `animation-fill-mode`,我们可以定义元素在动画结束或开始前的状态。 28 | 29 | 使用 `forwards` 表示当动画完成后,元素属性保持最后一个关键帧的值。使用 `backwards` 表示动画完成后,元素属性变成第一帧(这个第一帧不是关键帧的第一帧,[CodePen Demo](https://codepen.io/jiangxiaoxin/pen/QzWYwG))的值。【Tips:`animation-fill-mode` 除了这里说的两个之外还有多个可选值。】 30 | 31 | 例子:[bouncer animation on Hop.ie](http://hop.ie/)。 使用 `forwards`,动画播放一次并在最后一帧结束。【Tips:这个例子貌似没有啊,我翻遍了也没找到】 32 | 33 | 这里添个例子来说明下 forwards 和 backwards(原作者并没有写)。 34 | 在这个[例子](https://codepen.io/jiangxiaoxin/pen/QzWYwG)里使用了 animation-delay 和 animation-fill-mode。从效果上来看,设置 backwards,点击“开始动画”之后,backwards 会立刻变成动画真实过程(animation-duration)第一帧的样子,一直持续整个 animation-delay 时间,然后开始变化,最后动画结束后又变回了最一开始没有添加动画时的状态。 35 | 36 | ![](images/animation-fill-mode.gif) 37 | 38 | ### animation-iteration-count 39 | 40 | 这是动画播放的次数。默认情况下,它将播放一次。也可以指定一个数字,或指定 "infinite" 以使其永久循环。 41 | 42 | ### animation-name 43 | 44 | `animation-name` 指的是动画使用的 `keyframes` 的名字。例如,如果 `animation-name` 设置为 “foo”,它将使用一组下面这样的关键帧,如: 45 | 46 | @keyframes foo { 47 | ... 48 | } 49 | 50 | ### animation-play-state 51 | 52 | 如果您需要暂停或恢复动画,则可以使用此属性执行操作。值为 `running` 或 `paused`,默认为 `running`。可以使用 JavaScript 设置此值,控制动画播放状态。 53 | 54 | ### animation-timing-function 55 | 56 | 此属性与 transitions 中定时函数属性的值相同,但略有不同。在 `transition`里时间函数(例如 `ease-out`)是作用于整个 transition,但 `animation` 里是作用于关键帧之间。 57 | 58 | 这意味着以下关键帧将看到动画快速启动并减速至50%,然后快速开始并在100%之前减速。 59 | 60 | @keyframes foo { 61 | 0%{ 62 | / *动画开始时变化速度很快,然后按照ease-out的时间函数,到50%之前越来越慢* / 63 | } 64 | 50%{ 65 | / *然后又开始的时候很快,然后慢慢减速至100%的时候* / 66 | } 67 | 100%{ 68 | / * 结束 * / 69 | } 70 | } 71 | 72 | 这看起来有些复杂。通常在创建关键帧动画时,我会选择 `linear`,用使用 `keyframes` 控制动画的节奏。 73 | 74 | `cubic-bezier` 与动画一起使用可以产生一些很好的效果,大家可以尝试一下。 75 | 76 | ## Using timing functions within keyframes 77 | 78 | 值得注意的是,当为动画指定时间函数时,这个函数会应用到动画的*每个关键帧*之间。 79 | 80 | 也就是说如果有四个关键帧,并且使用 ease-out,那么在上一帧与下一帧之间,变化速度会越来越慢。 81 | 82 | 所以我们通常会将动画的计时功能定义为 linear,然后在每个关键帧的上控制速度: 83 | 84 | @keyframes my-animation { 85 | 0%{ 86 | ... 87 | animation-timing-function: linear; 88 | } 89 | 50%{ 90 | ... 91 | animation-timing-function: ease-out; 92 | } 93 | } 94 | 95 | 在这种情况下,动画的前半部分将是线性的,而后半部分将使用 `ease-out` 计时功能。 96 | 97 | ## Homework 98 | 99 | 这里有一个[例子](http://codepen.io/donovanh/pen/MYMJRd?editors=010)。尝试更改其中一些属性,看看会发生什么。 100 | -------------------------------------------------------------------------------- /chapters/03/03.md: -------------------------------------------------------------------------------- 1 | # Keyframes in action 2 | 3 | 前面章节我们学习了 `animation` 属性,并且初步了解了 `keyframes`。这一节我们来深入学习下 `keyframes`。 4 | 5 | ## Things to look out for 6 | 7 | 下面是一个简写方式,只有两个状态,初始状态和终止状态,与 0% 和 100% 的写法是等价的。 8 | 9 | ```css 10 | @keyframes name { 11 | from { 12 | ... 13 | } 14 | to { 15 | ... 16 | } 17 | } 18 | ``` 19 | 20 | 有时候我们会像下面这样,在一行内写好几个百分比数值,这类似一个暂停的效果。下面的 `0%, 20%` 的意思是,在 `0%` 的时候,元素的 `opacity` 的值为0,然后保持这个“状态”直到 `20%`,然后 `opacity` 开始改变,并在 `100%` 的时候变为1。后面我们会用到这个知识点。 21 | 22 | ```css 23 | @keyframes name { 24 | 0%, 20% { 25 | opacity: 0; 26 | } 27 | 100% { 28 | opacity: 1; 29 | } 30 | } 31 | ``` 32 | 33 | ## Example: Save button wiggle effect 34 | 35 | 还记得之前讲过的"Save"按钮吗?我们再重新回顾一下: 36 | 37 | ![Source: http://codepen.io/donovanh/pen/KwEQdQ](images/save_button-min.gif) 38 | 39 | 在开始添加 `animation` 之前,我先在页面上添加了一个按钮,然后设置了它的基本样式,让它看起来像 `CodePen` 的按钮。在这里我用了绝对定位让它显示在屏幕的中间。 40 | 41 | 然后我给按钮添加了 `animation`:将添加名为 "wiggle" 的 keyframes,持续2s时间,时间函数用 `linear`。 42 | 43 | ```css 44 | button { 45 | animation: wiggle 2s linear infinite; 46 | } 47 | ``` 48 | 49 | 最后的 `infinite` 是新属性,它是 `animation-iteration-count` 的一个可选值。我们可以通过设置 `animation-iteration-count` 让动画效果重复我们想要的次数,默认是1次。这里设置为 `infinite` 表示动画将一直重复。 50 | 51 | 来看下 `keyframes` 的完整代码: 52 | 53 | ```css 54 | @keyframes wiggle { 55 | 0%, 7% { 56 | transform: rotateZ(0); 57 | } 58 | 15% { 59 | transform: rotateZ(-15deg); 60 | } 61 | 20% { 62 | transform: rotateZ(10deg); 63 | } 64 | 25% { 65 | transform: rotateZ(-10deg); 66 | } 67 | 30% { 68 | transform: rotateZ(6deg); 69 | } 70 | 35% { 71 | transform: rotateZ(-4deg); 72 | } 73 | 40%, 100% { 74 | transform: rotateZ(0); 75 | } 76 | } 77 | ``` 78 | 79 | 在上面的代码里我们设置了一系列的关键点(`waypoint`),在每一个点都将按钮绕z轴(z-axis)旋转一定角度。 80 | 81 | 具体怎么旋转和变化的我们看下面的动图,我们发现浏览器自动完成了每个关键帧之间的插值。 82 | 83 | ![Source: http://codepen.io/donovanh/pen/pvXJqp](images/wiggle-min.gif) 84 | 85 | [CodePen链接](http://codepen.io/donovanh/pen/KwEQdQ) 86 | 87 | ## Homework 88 | 89 | 看下面的例子:[a new CodePen with a single animated element](http://codepen.io/donovanh/pen/azgjMz?editors=010)。该例子综合使用了 `animation` 里的 "animation-timing-function" 和 "keyframes"。 90 | 91 | 尝试删掉几个 frame,或者修改下百分比的数值,看看会有什么效果。 92 | -------------------------------------------------------------------------------- /chapters/03/04.md: -------------------------------------------------------------------------------- 1 | # Multiple animations 2 | 3 | 这一节我们看一下怎样同时使用多个 animation 4 | 5 | ## Traffic lights 6 | 7 | 有这么种情况:一个页面上会有好几个 animation,每个 animation 都有自己的时间设置,我们希望这些 animation 保持同步,最好的例子就是交通灯了。【TIPS:同步的意思是说,希望这些 animation 之间保持一种确定的时间关系。】 8 | 9 | ![Source: http://codepen.io/donovanh/pen/ogRRdR?editors=010](images/traffic-lights-min.gif) 10 | 11 | 这里有3盏灯,我们为每一盏灯写了一个 animation 12 | 13 | ```css 14 | .red { 15 | animation: red 10s linear infinite; 16 | } 17 | .amber { 18 | animation: amber 10s linear infinite; 19 | } 20 | .green { 21 | animation: green 10s linear infinite; 22 | } 23 | ``` 24 | 25 | 从上面样式里看出,每盏灯的 animation 持续时间都是10s,那动画不断循环播放的时候,它们之间就会一直保持同步的时间关系。 26 | 27 | 参照下面的图,从功能出发,很容易理解3盏灯的动画之间的逻辑关系(在这里逻辑关系就是指的它们之间的时间关系) 28 | 29 | ![](images/traffic-light-grid.png) 30 | 31 | 从图中看,一共分5个阶段或者说5个步骤,在每个阶段,不同的灯处于 on 或者 off 的状态。那么我们很明显就是将0% - 100%的时间跨度分成5份,每20%为一个状态,设置不同状态下的参数。 32 | 33 | 我们从红灯开始看。`0%-20%` 和 `20%-40%`,这两个阶段红灯一直亮的,其余的时间都是黑的。那我们可以这么设置: 34 | 35 | ```css 36 | @keyframes red { 37 | 0% { 38 | background: black; 39 | } 40 | 2%, 40% { 41 | background-color: red; 42 | } 43 | 42%, 100% { 44 | background: black; 45 | } 46 | } 47 | ``` 48 | 49 | 这里有`2%`的间隙,是为了让灯看起来有点渐变的效果。可以按照`20%``40%`去写 50 | 51 | 同理,黄灯是`20%-40%`和`80%-100%`亮,其余时间不亮。这里也加了`2%`的间隙。 52 | 53 | ```css 54 | @keyframes amber { 55 | 0%, 20% { 56 | background: black; 57 | } 58 | 22%, 40% { 59 | background: #FF7E00; 60 | } 61 | 42%, 80% { 62 | background: black; 63 | } 64 | 82%, 100% { 65 | background: #FF7E00; 66 | } 67 | } 68 | ``` 69 | 70 | 绿灯也很简单,按照图上显示的,来设置它。 71 | 72 | ```css 73 | @keyframes green { 74 | 0%, 40% { 75 | background: black; 76 | } 77 | 42%, 80% { 78 | background: green; 79 | } 80 | 82%, 100% { 81 | background: black; 82 | } 83 | } 84 | ``` 85 | 86 | ## Further reading 87 | 88 | 想了解更多,欢迎阅读 [CSS tricks article on the subject](https://css-tricks.com/snippets/css/keyframe-animation-syntax/) 89 | 90 | ## Homework 91 | 92 | 例子中的交通灯是按照 UK 的规则来的,你可以尝试修改参数,将其改成其他规则的,看看效果怎么样。 93 | -------------------------------------------------------------------------------- /chapters/03/05.md: -------------------------------------------------------------------------------- 1 | # Animation recap 2 | 3 | 目前为止,我们已经讨论了很多细节,我希望这对你们是有帮助的。 4 | 5 | 当我学习这个的时候,我必须承认我花了一些时间来深入了解动画和关键帧。如果到现在你还不是特别了解,不要灰心沮丧。坚持下去,你将会逐渐掌握使用动画的技巧。 6 | 7 | 在本章中,我们将花一点时间来回顾一下之前学习过的内容。首先,让我们来看看作业挑战! 8 | 9 | ## Homework challenge: Traffic lights 10 | 11 | 如果你知道该怎么做的话,这个家庭作业挑战应该很简单。我已经写了一个[英国交通灯的示例](https://codepen.io/donovanh/pen/ogRRdR?editors=010),请更改顺序,删除「红灯---黄灯」的阶段。 12 | 13 | [看这里](https://codepen.io/donovanh/pen/vEqbdw?editors=010),我已经使颜色组合符合美国交通灯的样子。 14 | 15 | ## Recap: Animations 16 | 17 | 在这一章节,我们学习了 `animation` 属性,以及该如何使用它和 `keyframes`。 18 | 19 | ### Like a transition, only different 20 | 21 | 虽然 `animation` 属性的表现效果以及工作原理与 `transition` 类似,但是它还是有一些细微的差别。过渡仅在元素发生变化时才会发生,而动画可以立刻开始。 22 | 23 | 使用各种属性,动画可以循环一定次数(或者永远循环下去),甚至可以从一个负值开始延迟,这就会以已经进行的动画开始。 24 | 25 | 默认情况下,动画都会从头到尾播放,然后跳到它们的默认状态。我们可以使用 `forward` 的 `animation-direction` 属性让动画在它结尾时定格。 26 | 27 | 动画用到了 `timing-function`,这一点很像过渡。然而,`timing-function` 是用在每一个的 `keyframe`,**并不是**整个的 `keyframes`。相反地,你可以在 `keyframe` 中指定 `animation-timing-function` 进行更细粒度的控制。 28 | 29 | 最后,动画可以用简写方式来指定,就像过渡一样: 30 | 31 | ```css 32 | animation: keyframe-name 2s forwards linear; 33 | ``` 34 | 35 | ### Keyframes 36 | 每一个动画都需要引用一组的 `keyframes`。这些 `keyframe` 是一系列百分比,描述了动画的每个“阶段”。而浏览器会自动填充其间隙。 37 | 38 | 当您只想从一个状态转换到另一个状态时,`keyframe` 有它们自己的名称(to 和 from)。 39 | 40 | 在这段时间里,相互叠加的百分比可以让动画暂停。 41 | 42 | 最后,可以忽略0%关键帧,而浏览器可以使用元素默认的样式。例如,想让某样东西渐渐消失,我们不需要设置它的初始透明度为1(假设元素已经存在): 43 | 44 | ```css 45 | @keyframes name { 46 | 100% { 47 | opacity: 0; 48 | } 49 | } 50 | ``` 51 | 52 | ## Putting them together 53 | 54 | 如果想要使用动画,必须按照如下的格式: 55 | 56 | ```css 57 | .element { 58 | animation: keyframe-name ... 59 | } 60 | @keyframes keyframe-name { 61 | ... 62 | } 63 | ``` 64 | 65 | ## Homework 66 | 67 | 目前为止,我们应该清楚了动画属性和过渡属性的区别了吧。 68 | 69 | 看看 [Principles of Animation for the Web](https://codepen.io/collection/AxKOdY/) 上面的例子。每一个例子都包含了 HTML 和 CSS,以及关键帧动画。尝试着去修改一个吧。 70 | -------------------------------------------------------------------------------- /chapters/04/01.md: -------------------------------------------------------------------------------- 1 | # Storytelling 2 | 3 | 现在我们已经介绍了 `transition` 和 `animation` 属性,让我们将它们组合成一个具有悬停效果的动画。 4 | 5 | ## Heroes 6 | 7 | 许多网站都喜欢在主页顶部使用一个引人注目的大图像。有时称为 “hero image”,通常是横向大图样式。 8 | 9 | 我最近发现的一个很好的例子是 Fabric 登陆页面。CSS animatiom 显示了 Fabric 如何为模块化框架工作。 10 | 11 | ![Source: https://get.fabric.io/](images/fabric-min.gif) 12 | 13 | 另一个有趣的例子是 Mailchimp 主页。在这里,hero image 讲述了如何创建电子邮件的故事。 14 | 15 | ![Source: http://mailchimp.com](images/mailchimp-min.gif) 16 | 17 | 您可能还在 [my CSS Animation 101 email course](https://cssanimation.rocks/courses/animation-101/) 登录页面上看到了它: 18 | 19 | ![Source: https://cssanimation.rocks/courses/animation-101/](images/course-min.gif) 20 | 21 | 在以上示例中,他们都使用动画来设置页面的色调并说明网站的内容。 22 | 23 | ## Example: Scrolling background 24 | 25 | 让我们创建一个例子。在这个例子中,我创建了一个在网页上下移动的 “web page” 样式图形。 26 | 27 | ![Source: http://codepen.io/donovanh/pen/LEwedW?editors=110](images/screen-min.gif) 28 | 29 | 对于一些交互、动画暂停、鼠标悬停在屏幕上时显示消息等都是利用 animations 和 transitions 来实现的。 30 | 31 | [See it in action here](http://codepen.io/donovanh/pen/LEwedW?editors=110)。 32 | 33 | ## Part 1: Background animation 34 | 35 | 要设置此示例,我们从 HTML 元素开始: 36 | 37 |
38 | 39 | 我们可以使用某些样式使 “screen” 容器看起来像显示器或 iPad: 40 | 41 | .screen { 42 | background: #e25865 url(//cssanimation.rocks/screen/images/screen_bg.png) no-repeat top center; 43 | background-size: 100% auto; 44 | border: 2em solid #fff; 45 | border-radius: 1em; 46 | width: 40em; 47 | height: 30em; 48 | } 49 | 50 | 我们有一些定义大小和边框的样式,以及 [setting a background image](https://cssanimation.rocks/screen/images/screen_bg.png)。 51 | 52 | 我们创建的效果基于移动背景图像。背景图像比屏幕高,并且 `background-size` 设置为 `100% auto`。这意味着背景将自适应容器的宽度并能同比例调整高度。 53 | 54 | 增加背景图像的动画处理,我们现在可以编写 `keyframes`,使其看起来像某人正在滚动网页: 55 | 56 | @keyframes scroll { 57 | 0%, 10% { 58 | background-position: 0 0; 59 | } 60 | 20%, 30% { 61 | background-position: 0 -22em; 62 | } 63 | 50%, 60% { 64 | background-position: 0 -44em; 65 | } 66 | 90%, 100% { 67 | background-position: 0 0; 68 | } 69 | } 70 | 71 | 这里设置动画的属性是 `background-position`。有了这个属性,我们可以上下移动它。它从`0 0`开始,这意味着从左上角开始。 72 | 73 | 在接下来的帧中,我们将背景移动22 ems,然后是44 ems,然后返回到页面顶部。让我们创建一个动画属性,将其应用于“screen”元素。 74 | 75 | .screen { 76 | animation: scroll 5s infinite cubic-bezier(.52,-0.39,.3,1.43); 77 | } 78 | 79 | 这个CSS应用了一组名为 “scroll” 的关键帧,动画时长5秒,循环播放并使用 `cubic-bezier` 计时功能。在这种情况下,立方贝塞尔函数给动画增加了弹性效果,没有它,运动看起来就不那么逼真了。 80 | 81 | 我在 [cubic-bezier.com](http://cubic-bezier.com/#.52,-0.39,.3,1.43) 上创建了这个 bezier。如果您尚未为该网站添加书签,我强烈建议您加上! 82 | 83 | ## Part 2: Adding the hover transition 84 | 85 | 在动画结束后或者希望人们专注于其他动画时最好暂停或停止动画。循环播放的动画可能会分散注意力,所以我们可以使用 `animation-play-state` 属性在悬停时暂停动画。 86 | 87 | .screen:hover { 88 | animation-play-state: paused; 89 | } 90 | 91 | 上述代码表示当光标悬停在动画上时,它将暂停。当光标再次移开时,它将恢复其默认的 `playing` 状态。 92 | 93 | 您也可以使用 JavaScript 实现此目的。一种可能性是当用户与页面的另一部分交互时,或者当它们滚动时,让一些 JavaScript 禁用动画。我们将看一下如何在以后滚动时启用动画。 94 | 95 | ### Adding a message 96 | 97 | 当用户将鼠标悬停在元素上时,我们可以使用 transition 来显示消息。要做到这一点,我们需要更多的 HTML: 98 | 99 |
100 |
Hover message!
101 |
102 | 103 | 在 [the CodePen CSS](http://codepen.io/donovanh/pen/LEwedW?editors=110) 中,我们将此消息放在 “screen” 的中并使其不可见。 104 | 105 | .message { 106 | /*... positioning styles ...*/ 107 | opacity: 0; 108 | transition: all 0.4s ease-out; 109 | } 110 | 111 | 然后我们可以使用 `transition` 在悬停时显示它: 112 | 113 | .screen:hover .message { 114 | opacity: 1; 115 | } 116 | 117 | 由于我们在 “message” 样式上设置了 `transition`,因此当光标悬停在元素上和离开时,它都会创建动画。暂停的动画和过渡效果如下所示: 118 | 119 | ![Source: http://codepen.io/donovanh/pen/LEwedW?editors=110](images/screen-hover-min.gif) 120 | 121 | ## Summary 122 | 123 | 在本章中,我们将 animation 和 transition 组合在一起,创建了用于登录页面和产品导览的效果。我们利用 `animation-play-state` 来确保动画在我们想要时停止。 124 | 125 | ## Homework 126 | 127 | 花一点时间思考我们到目前为止所涵盖的内容。 128 | 129 | 我们讲述了很多。结合 animation 和 transition 是将页面变为现实的有效方式。 130 | 131 | 在考虑如何将其应用于您的工作时,请考虑如何控制它。什么时候动画可以为您的用户带来好处,什么时候可以起作用呢?很高兴知道如何制作动画,但更好的是知道什么时候不使用动画。 132 | -------------------------------------------------------------------------------- /chapters/04/02.md: -------------------------------------------------------------------------------- 1 | # Star Wars 2 | 3 | 可乐爆米花准备好了么!在这章中我们要做一个有意思的 SVG 动画。我们将在 “The Force Awakens”(《星球大战7:原力觉醒》)电影预告片中制作 “Star Wars” 的片名。。 4 | 5 | ![Source: https://www.youtube.com/watch?v=ngElkyQ6Rhs](images/starwars-min.gif) 6 | 7 | 这个例子是将 CSS 动画与其他一些 CSS 属性相结合后呈现的,特别是 `transforms`、`scale`、`translate` 和 `rotate`。 8 | 9 | ## Transform: Not an animation property 10 | 11 | 虽然听起来它可能会创建动画,但 transform 属性实际上对元素进行旋转、缩放、移动或倾斜。我们可以使用它来创建出色的效果但是为了做到这一点,我们需要对每个关键帧或动画状态进行不同的变换。 12 | 13 | ## Transform: scale(), translateZ() and rotateY() 14 | 15 | 我们可以使用 `scale` 来控制元素缩放。使用 `translateZ`,我们可以在 Z 轴上移动元素。Z 轴就是从你到屏幕画一条线来表示的轴。 16 | 17 | 在这种情况下,我们将使用 scale 和 translateZ 的组合使其看起来像一些单词在太空中飞行。 18 | 19 | 最后,我们将使用 `rotateY` 来旋转标语的字母。围绕 Y 轴旋转将需要在浏览器中进行一些 3D 工作。 20 | 21 | ## SVG,HTML和CSS 22 | 23 | 为了准备这个例子,我为徽标 [Star](https://cssanimation.rocks/demo/starwars/images/star.svg) 和 [Wars](https://cssanimation.rocks/demo/starwars/images/wars.svg) 制作了两个 SVG 文件。如果你想试试,可随意使用。 24 | 25 | 演示的 HTML 如下: 26 | 27 |
28 | Star 29 | Wars 30 |

The Force Awakens

31 |
32 | 33 | 静态图像 [of some stars](https://cssanimation.rocks/demo/starwars/images/bg.jpg) 用于背景。副标题中的字体很难找到,所以我在本例中引用了 Web 字体 “Lato”。 34 | 35 | 通过一些绝对定位将内容定位在屏幕中间,我们从这开始: 36 | 37 | ![](images/starwars.png) 38 | 39 | ## Animating the Star and Wars 40 | 41 | 我们希望较大的文本淡入视野,同时随着时间推移开始变大后变小。这是 `scale()`变换的一个很好的例子。让我们在 “Star” 这个词上使用以下关键帧: 42 | 43 | @keyframes star { 44 | 0% { 45 | opacity: 0; 46 | transform: scale(1.5) translateY(-0.75em); 47 | } 48 | 20% { 49 | opacity: 1; 50 | } 51 | 89% { 52 | opacity: 1; 53 | transform: scale(1); 54 | } 55 | 100% { 56 | opacity: 0; 57 | transform: translateZ(-1000em); 58 | } 59 | } 60 | 61 | 在此动画过程中有两个属性会发生变化。`opacity` 和 `transform`。opacity 属性使其开始透明,并在最后逐渐消失,以便我们可以循环动画。 62 | 63 | 通过将 scale 设置为`1.5`倍大小。这意味着文本的初始大小比正常大150%。在89%时,我们将 transform 的 scale 属性设置为1。这意味着在0%和89%之间,比例从150%到100%。 64 | 65 | 最后的 `transformZ` 使单词快速缩小。 66 | 67 | 我们可以将这些关键帧应用于单词 “Star”,如下所示: 68 | 69 | .star { 70 | animation: star 10s ease-out infinite; 71 | } 72 | 73 | 同样,“Wars” 一词也是这样处理。 74 | 75 | ## Making it 3D 76 | 77 | 在 CSS 中使用 3D 变换,无论是沿 Z 轴平移,还是围绕 Y 轴和 Z 轴旋转,都需要为 3D 设置一个平台。在 HTML 术语中,这意味着我们创建一个容器,并告诉浏览器将发生一些 3D 效果。 78 | 79 | 我们通过在 `.starwars-demo` 容器中添加以下内容来实现: 80 | 81 | .starwars-demo { 82 | perspective: 800px; 83 | transform-style: preserve3d; 84 | } 85 | 86 | 这两个属性告诉浏览器指定子元素定位在三维空间内,而不是平面。[CSS Tricks](https://css-tricks.com/almanac/properties/t/transform-style/) 详细介绍了该属性。 87 | 88 | 其次,`persective` 属性告诉浏览器场景需要 “deep”(深度)。以防万一我们将深度定为`800px`。由于场景较短,较小的值会产生更多 “extreme”(极端)的透视效果。 89 | 90 | 有了这个,我们开始介绍标语。 91 | 92 | ## The Force Awakens 93 | 94 | 标语 “The Force Awakens” 出现在预告片中,每个字母都旋转到位。我们可以使用 `rotateY` 变换创建这个效果。在这种情况下,我们将每个字母包裹在 `span` 元素中,以便我们可以将动画应用于每个字母。 95 | 96 | 我很快发现的一个问题是,没有一种简单的方法来为副标题中的每个字母设置动画。我的第一种方法是手动将每个字母包装在 `span` 标签中。这有效,但使 HTML 有点混乱。当前的演示包括一些 JavaScript(感谢[Tady](https://twitter.com/tadywankenobi)的帮助),它将每个字母自动包装在 `span` 中。 97 | 98 | 我们将为每个字母应用动画。 99 | 100 | 首先,关键帧: 101 | 102 | @keyframes spin-letters { 103 | 0%, 10% { 104 | opacity: 0; 105 | transform: rotateY(90deg); 106 | } 107 | 30% { 108 | opacity: 1; 109 | } 110 | 70%, 86% { 111 | transform: rotateY(0); 112 | opacity: 1; 113 | } 114 | 95%, 100% { 115 | opacity: 0; 116 | } 117 | } 118 | 119 | 首先,字母旋转90度,然后动画旋转70%转为0度,即字母转为面向观众。 120 | 121 | 我们可以将这组关键帧应用于每个span,如下所示: 122 | 123 | .byline span { 124 | animation: spin-letters 10s linear infinite; 125 | } 126 | 127 | 结果是,每个字母的每个 “span” 容器都会逐渐淡入并慢慢旋转到位,然后在动画结束时逐渐消失。 128 | 129 | 把它放在一起就是 [finished demo](http://codepen.io/donovanh/pen/pJzwEw?editors=110)。 130 | 131 | ![Source: http://codepen.io/donovanh/pen/pJzwEw?editors=110](images/css-starwars-min.gif) 132 | 133 | ## Homework 134 | 135 | 如果你有时间我会鼓励你看一下 [CodePen version](http://codepen.io/donovanh/pen/pJzwEw?editors=110)。 136 | 137 | 你可能会注意到 CSS 中的一些 “media” 查询。我们使用 “media” 来调整适应较小的设备。尝试更改一些动画关键帧,或 `transform` 值来查看会发生什么。 138 | -------------------------------------------------------------------------------- /chapters/04/03.md: -------------------------------------------------------------------------------- 1 | # Revealing content on scroll 2 | 3 | Web动画的一种常见用途是在浏览器滚动时向元素添加动作。在本章中,我们将了解如何执行此操作。 4 | 5 | 这是 [today's demo on CodePen](http://codepen.io/donovanh/pen/gbVMjm)。尝试向下滚动页面,看看引用文本和猫是如何淡入的。 6 | 7 | ## Wow.js 8 | 9 | 当您的鼠标滚动到某个点时,许多站点会触发自定义动画。他们或者开始播放视频、触发复杂的关键帧动画,或只是将项目淡入到某位置来吸引访问者的注意力。 10 | 11 | 每一种情况通常是,当元素在屏幕上可见时 JavaScript 为其添加一个 class 类来控制其动作。然后我们可以将动画附加到 class 中,当浏览器滚动时动画从正确的时间开始。 12 | 13 | 有许多 JavaScript 选项可以添加类,我发现了一个好用的是 [Wow.js](http://mynameismatthieu.com/WOW/)。让我们用 Wow.js 来创建一个简单的例子,当我们滚动鼠标时,内容会淡入视图。 14 | 15 | ![Source: http://codepen.io/donovanh/pen/gbVMjm](images/scroll-min.gif)"> 16 | 17 | ## Using Wow.js 18 | 19 | 使用 Wow.js 涉及两个步骤。第一个是 [download the JavaScript](https://raw.githubusercontent.com/matthieua/WOW/master/dist/wow.min.js)。将 `wow.min.js` 文件放在项目的 JavaScript 文件夹中。下一步是从 HTML 中引用此文件: 20 | 21 | 22 | 23 | (假设您的文件夹名为 `javascripts` - 根据需要更改) 24 | 25 | 然后,我们使用以下命令调用 JavaScript(将其粘贴到上一个代码之后): 26 | 27 | 30 | 31 | 我们现在可以为我们的内容添加 “wow” 类,Wow.js 将负责确定我们的内容是否显示。 32 | 33 | ## Adding "wow" classes 34 | 35 | 如果我们有一个想要在元素上添加滚动动画,首先要确保它具有 “wow” 类: 36 | 37 |

...

38 | 39 | 这意味着当浏览器将此内容滚动到屏幕上时,Wow.js 会向该 class 添加 “animated”,如下所示: 40 | 41 |

...

42 | 43 | 如果我们的 `p.animated` 元素上有动画,动画只会在添加这个 class 时发生。 44 | 45 | ## Hiding and showing 46 | 47 | 对于我们的示例,我们将使用 `wow` 样式隐藏所有元素,并在 `animated` 时显示它们。首先,我们隐藏它们: 48 | 49 | .wow { 50 | opacity: 0; 51 | transition: all 0.5s 0.5s ease-out; 52 | } 53 | 54 | 我们在这里也应用了一个 `transition`,这样元素就会淡入。请注意第二个`0.5s`。在这种情况下,我们还增加了半秒的“延迟”。这样元素在淡入之前能正确滚动到视图中。 55 | 56 | 下一段代码定义了添加 Wow.js 的 `animated` 时元素的外观: 57 | 58 | .animated { 59 | opacity: 1; 60 | } 61 | 62 | 现在我们应该会遇到这样的情况,当用户滚动时,项目会淡入 [Animate.css](http://daneden.github.io/animate.css/)。 63 | 64 | ## Using Animate.css 65 | 66 | Wow.js 与 CSS 框架 [Animate.css](http://daneden.github.io/animate.css/) 配合使用效果更好。我还没有在这个例子中使用过,因为理解如何创建我们自己的 transitions 是有好处的,但是值得看一下 Animate.css 提供的开源的 transitions。 67 | 68 | 在 [this example](http://codepen.io/donovanh/pen/xbvOQK) 我使用了 Animate.css。请注意 CSS 中没有 animations 或 transitions。相反,我在HTML中添加了一个 class 告诉 Animate.css 要应用哪个动画: 69 | 70 |
71 | 72 | `bounceInUp` 是对 Animate.css 的许多内置动画之一的引用。如果在示例中的 CSS 部分选择 “cog”,您将看到我在 “External CSS file” 下引用了 Animate.css 框架。 73 | 74 | ## Using Modernizr 75 | 76 | 通常情况下一般先隐藏内容再使用 JavaScript 显示内容。人们可能因为某种工作原因对 JavaScript 并不熟悉。诸如 [Modernizr](http://modernizr.com/) 之类的脚本可用于处理此问题。它会在文档正文中添加一个 `js` 类,然后我们可以将它们添加到我们的样式中。 77 | 78 | 这个 [demo](http://codepen.io/donovanh/pen/gbVMjm) 中包含了 Modernizr。 79 | 80 | ## Homework 81 | 82 | 让内容逐渐淡出是一个很好的开始,但是您是否可以想象用这种方式来为您的设计和网站增加价值?当用户浏览时,请注意滚动出内容时开始动画的时间。 83 | 84 | 它何时起作用,什么时候又不那么好用? 85 | -------------------------------------------------------------------------------- /chapters/04/04.md: -------------------------------------------------------------------------------- 1 | # Accessibility 2 | 3 | 目前为止,我们已经学习了网页动画,以及如何创建它。在结束这门课程之前,我们来花点时间思考一下我们可以做点什么来确保读者正确使用动画。 4 | 5 | 动画可以丰富我们的内容,也可能适得其反。 6 | 7 | ## Make sure content is accessible 8 | 9 | 之前章节用过的例子,使用动画显示内容。假如该内容区域的初始状态是不可见的,这时候就需要注意它是否会正确显示。因为老版本的浏览器对 CSS 动画的兼容性不是很好,同样地,JavaScript 在老版本的浏览器上的运行效果也不是一直都不会出错的。我们可以使用像 [Modernizr](https://modernizr.com/) 这样的工具来规避潜在的问题。 10 | 11 | 在设计中,我们使用动画来传达我们想要表达的意义和意图。当你在设计动画时,一定要把浏览器的兼容性考虑进去。因为有的人可能正在使用屏幕阅读器或者浏览器有不同的设置,这些都有可能导致你的动画无法正常工作。但是无论动画是否正常工作,都要确保重要信息不会丢失。 12 | 13 | 好比[自动播放的视频带给用户极差的体验](http://www.punkchip.com/autoplay-is-bad-for-all-users/),自动播放的动画可能会分散用户的注意,带来不好的用户体验。当你想用动画去吸引用户的注意时,试着限制一下动画发生的位置和时机。这意味着可能需要限制动画播放的时间,或确保用户在关注其他内容之前已经停止动画。 14 | 15 | ## Give control 16 | 17 | W3C [建议](https://www.w3.org/TR/2008/REC-WCAG20-20081211/#time-limits-pause),任何闪烁、滚动或自动更新时间超过5秒的内容都应该有暂停或删除动画的方法。使用 `animation-play-state` 是一种暂停动画的方法,具体例子看[这里](https://codepen.io/donovanh/pen/LEwedW)。 18 | 19 | ## Allow for alternate inputs 20 | 21 | 越来越多的用户使用手机来访问网页。在手机上,即没有光标,也没有悬停状态。所以我们需要围绕这个来设计动画。我经常用到的解决方案是:检测 tap 并向目标添加一个 'class',然后,将 `transition` 或 `animation` 添加到 `:hover` 和 `.active` 状态。 22 | 23 | ## Confusion 24 | 25 | 有时候网站背离了设计的初衷,它试图让所有的东西都动起来。这样不仅会混淆网站的信息,还会让人感到困惑。特别是 UI,当向页面元素添加动画时,请确保动画被触发的方式是显而易见的。因为用户没有时间去解读复杂的设计以及移动方式,所以请尽可能的清晰。 26 | 27 | ## Don't make me sick 28 | 29 | 太多的动画,或是错误的动画,都会降低用户体验。 30 | 31 | 当苹果公司推出新的操作系统 iOS7 时,它支持更多的动作和动画。其中一些的[用户体验并不好](http://reverttosaved.com/2013/09/28/why-ios-7-is-making-some-users-sick/),有些人喜欢在车上用手机阅读,如果有过多的动画会让人觉得更容易晕车。 32 | 33 | 这就会牵扯到我们的[前庭神经系统](https://www.youtube.com/watch?v=dSHnGO9qGsE)是如何工作的。我们的耳朵里有三对半规管帮助我们确定头部在三维空间中的位置。简单解释为什么会晕车,当人坐在移动的车或船里面,内耳的前庭已经感知到身体在运动,但眼睛却以为身体是静止不动的。前庭已经向各部门发送信号了,但身体却没有做出反应,于是平衡调节就出错了!这种刺激一旦超过了个体承受的极限,就会导致晕车。这种症状在你望向左右的窗外、刷手机、看书的时候更强烈,因为这些行为让身体更加肯定自己是静止的,跟前庭传递的信号起了更大的冲突。 34 | 35 | 我们会生病是进化产生的副作用。为什么一晕车就会呕吐呢?当身体产生不良反应时,交感神经就会兴奋,想通过调节其他器官反应来应付环境变化、维持内环境的相对稳定。于是,肠胃就受到刺激,引发呕吐。 36 | 37 | 随着可穿戴技术的发展和开发,这可能会成为一个更大的问题。在设计浮动大的动画时,一定要考虑人们是否适应各种形态的运动类型。 38 | 39 | [Vestibular.org](https://vestibular.org/understanding-vestibular-disorder) 是了解这方面内容的一个很好网站。 40 | 41 | ## Accessibility is for everyone's benefit 42 | 43 | 可访问性不只是为使用屏幕阅读器或浏览我们内容的用户准备的。我们难免会有分心的时候。我们应该知道人们如何使用我们的产品来确保我们的动画不会适得其反。 44 | 45 | ## Homework 46 | 47 | 如果你的工作涉及到设计或构建界面,那么一定要花时间阅读这篇文章 [NNGroup's Animation for Attention and Comprehension](http://www.nngroup.com/articles/animation-usability/)。想想人们可能会如何使用你的作品,如果他们看不到动画,这可能意味着什么。 48 | -------------------------------------------------------------------------------- /chapters/04/05.md: -------------------------------------------------------------------------------- 1 | # Now you know CSS animation! 2 | 3 | 你已经完成了 CSS Animation 101!希望这本书对你有帮助。 4 | 5 | 在我们结束之前,让我们来看看一些你可能想要收藏的资源,并进一步地学习 CSS 动画。 6 | 7 | ## CSS Animation cheatsheet 8 | 9 | 我准备了一个备忘录清单,总结了过渡和动画的不同属性。它正好有一张 A4 纸的大小,尽情享受它吧。 10 | 11 | ## Resources to bookmark 12 | 13 | 知道如何创建 CSS 动画和过渡是件好事,但有时在现有平台上构建是很方便的。这里有一些很棒的工具,我们可以用它们来节省开发时间,提升开发效率。 14 | 15 | ### [Animate.css](https://daneden.github.io/animate.css/) 16 | 17 | Animate.css 给自己的定位是---just add water.你可以引用 CSS 文件并添加任何动画类来查看它们的运行情况。[这里有一些例子](https://codepen.io/donovanh/pen/xbvOQK). 18 | 19 | ### [Hover.css](http://ianlunn.github.io/Hover/) 20 | 21 | 是一个不错的替代品,Hover.css 是另一种可用于链接、按钮、徽标或任何其他 HTML 元素的动画。 22 | 23 | ## Other tools 24 | 25 | CSS 动画很强大,而且不需要借助 JavaScript 等其他技术就可以实现很多功能。然而,它并不是适合所有的情况。有时候需要更复杂的动画,JavaScript 能够帮助我们提高效率。最好的包都是构建在 CSS 之上,可以利用它的速度以及浏览器兼容性,但这会让你做更多的工作。 26 | 27 | ### [GSAP](https://greensock.com/gsap) 28 | 29 | Greensock Animation Platform 能够提供基于 JavaScript 的方法,以便创建出更高级的动画。它能够提供友好的操作接口以及稳定的性能。虽然它的学习曲线比较陡峭,但是它是一个很强大的工具。 30 | 31 | ### [Snabbt.js](http://daniel-lundin.github.io/snabbt.js/) 32 | 33 | Snabbt 能够以强大、优雅的方式、用自定义的定时函数去创建更复杂的动画。它能为浏览器生成动画转换矩阵,从而获得非常好的性能。 34 | 35 | ### [CSS Animate](http://cssanimate.com/) 36 | 37 | CSS Animate 是一个生成关键帧动画的工具。它可以通过拖拽一个对象并使用时间轴来设计动画。 38 | 39 | ### [Cubic-bezier.com](http://cubic-bezier.com/) 40 | 41 | 如果你想创造出一种生活的感觉时,我推荐的工具是:Cubic-bezier.com.这个简单的工具可以帮助你优化时间函数,另外,Chrome浏览器的检查器中也内置了类似的工具。 42 | 43 | ## Next steps 44 | 45 | 一些人提出的一个问题是:“我们如何才能越过101个阶段?” 46 | 47 | 我的建议是「挑战自己」。去这些网站上找寻灵感---[Dribbble.com](https://dribbble.com/)、[CodePen.io](http://codepen.io)。从一些流行产品、电影或电视节目中寻找创意。我会思考,我该如何在 Web 上实现这种效果?CSS 会是一种好的方法么? 48 | 49 | 你还可以去阅读这些网站上的博客---[CSS Tricks](https://css-tricks.com/)、[SaraSoueidan.com](http://sarasoueidan.com/articles/index.html)、[CSSAnimation.rocks](https://cssanimation.rocks/)。 50 | 51 | 所以,如果你不想遗忘这些知识,那就开始练习把。找到你感兴趣的东西,试着去做一些改变,那么你会发现这些知识对于你来说是非常简单的。 52 | 53 | ## Don't be a stranger, now 54 | 55 | 你是否受到了启发,想去尝试一下 CSS 动画?如果你有一些很炫酷的动画或者任何疑问,[请让我知道](mailto:hello@cssanimation.rocks)。我很期待你的来信。 56 | 57 | 你也可以在 twitter 上与我交流(@donovanh)。 58 | 59 | 最后,感谢你阅读本书。 60 | -------------------------------------------------------------------------------- /chapters/05/01.md: -------------------------------------------------------------------------------- 1 | # Level up your CSS animation skills! 2 | 3 | 恭喜你完成了本书的所有教程,希望你能有所收获。你还可以观看视频:[Level Up Your CSS Animation Skills](http://courses.cssanimation.rocks/p/level-up/)。 4 | 5 | 你将会学到以下内容: 6 | 7 | + Create an amazing animated hero header 8 | + Bring your UI to life with hover, touch and button animations 9 | + Wow your visitors with scroll and parallax animations 10 | + Build your very own animated carousel 11 | + Adjust animations to fit all sizes of devices and browsers 12 | + Optimise your CSS animations for reuse and size 13 | + Each with fun examples you can follow along, step by step 14 | 15 | 学习完本课程之后,希望你能够创造出一个令人印象深刻的登录页面。 16 | -------------------------------------------------------------------------------- /chapters/dictionary.md: -------------------------------------------------------------------------------- 1 | 名词 | 释义 | 备注 2 | ------------ | ------------- | ------------ 3 | animation | 动画 | 4 | transition | 过渡 | 5 | timing-function | 时间函数 | 6 | cubic bezier | 立方贝塞尔 | 7 | 8 | -------------------------------------------------------------------------------- /docs/images/ab-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ab-min.gif -------------------------------------------------------------------------------- /docs/images/ab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ab.gif -------------------------------------------------------------------------------- /docs/images/ab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ab.jpg -------------------------------------------------------------------------------- /docs/images/ab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ab.png -------------------------------------------------------------------------------- /docs/images/ab_animated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ab_animated.png -------------------------------------------------------------------------------- /docs/images/abc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/abc.png -------------------------------------------------------------------------------- /docs/images/animation-fill-mode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/animation-fill-mode.gif -------------------------------------------------------------------------------- /docs/images/animators_survival_kit_frame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/animators_survival_kit_frame.jpg -------------------------------------------------------------------------------- /docs/images/baymax-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/baymax-min.gif -------------------------------------------------------------------------------- /docs/images/baymax.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/baymax.gif -------------------------------------------------------------------------------- /docs/images/baymax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/baymax.png -------------------------------------------------------------------------------- /docs/images/button-element-positioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/button-element-positioning.png -------------------------------------------------------------------------------- /docs/images/button-element-positioning2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/button-element-positioning2.png -------------------------------------------------------------------------------- /docs/images/button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/button-min.gif -------------------------------------------------------------------------------- /docs/images/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/button.gif -------------------------------------------------------------------------------- /docs/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/button.png -------------------------------------------------------------------------------- /docs/images/cat-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cat-min.gif -------------------------------------------------------------------------------- /docs/images/cat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cat.gif -------------------------------------------------------------------------------- /docs/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cat.png -------------------------------------------------------------------------------- /docs/images/change-background-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/change-background-min.gif -------------------------------------------------------------------------------- /docs/images/change-background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/change-background.gif -------------------------------------------------------------------------------- /docs/images/change-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/change-background.png -------------------------------------------------------------------------------- /docs/images/course-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/course-min.gif -------------------------------------------------------------------------------- /docs/images/course.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/course.gif -------------------------------------------------------------------------------- /docs/images/course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/course.png -------------------------------------------------------------------------------- /docs/images/cover-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cover-small.png -------------------------------------------------------------------------------- /docs/images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cover.png -------------------------------------------------------------------------------- /docs/images/css-starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/css-starwars-min.gif -------------------------------------------------------------------------------- /docs/images/css-starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/css-starwars.gif -------------------------------------------------------------------------------- /docs/images/css-starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/css-starwars.png -------------------------------------------------------------------------------- /docs/images/cubic-bezier-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cubic-bezier-graph.png -------------------------------------------------------------------------------- /docs/images/cubic-bezier-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cubic-bezier-min.gif -------------------------------------------------------------------------------- /docs/images/cubic-bezier.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cubic-bezier.gif -------------------------------------------------------------------------------- /docs/images/cubic-bezier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/cubic-bezier.png -------------------------------------------------------------------------------- /docs/images/demo-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/demo-min.gif -------------------------------------------------------------------------------- /docs/images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/demo.gif -------------------------------------------------------------------------------- /docs/images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/demo.png -------------------------------------------------------------------------------- /docs/images/donovan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/donovan.jpg -------------------------------------------------------------------------------- /docs/images/donovan_hutchinson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/donovan_hutchinson.jpg -------------------------------------------------------------------------------- /docs/images/ease-in-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-in-min.gif -------------------------------------------------------------------------------- /docs/images/ease-in-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-in-out-min.gif -------------------------------------------------------------------------------- /docs/images/ease-in-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-in-out.gif -------------------------------------------------------------------------------- /docs/images/ease-in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-in.gif -------------------------------------------------------------------------------- /docs/images/ease-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-out-min.gif -------------------------------------------------------------------------------- /docs/images/ease-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ease-out.gif -------------------------------------------------------------------------------- /docs/images/fabric-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/fabric-min.gif -------------------------------------------------------------------------------- /docs/images/fabric.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/fabric.gif -------------------------------------------------------------------------------- /docs/images/files.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/files.jpg -------------------------------------------------------------------------------- /docs/images/js-triggered-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/js-triggered-button-min.gif -------------------------------------------------------------------------------- /docs/images/js-triggered-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/js-triggered-button.gif -------------------------------------------------------------------------------- /docs/images/linear-example-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/linear-example-min.gif -------------------------------------------------------------------------------- /docs/images/linear-example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/linear-example.gif -------------------------------------------------------------------------------- /docs/images/linear-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/linear-min.gif -------------------------------------------------------------------------------- /docs/images/linear.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/linear.gif -------------------------------------------------------------------------------- /docs/images/list_item-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/list_item-min.gif -------------------------------------------------------------------------------- /docs/images/list_item.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/list_item.gif -------------------------------------------------------------------------------- /docs/images/macplus-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/macplus-min.gif -------------------------------------------------------------------------------- /docs/images/macplus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/macplus.gif -------------------------------------------------------------------------------- /docs/images/mailchimp-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/mailchimp-min.gif -------------------------------------------------------------------------------- /docs/images/mailchimp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/mailchimp.gif -------------------------------------------------------------------------------- /docs/images/multiple-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/multiple-button-min.gif -------------------------------------------------------------------------------- /docs/images/multiple-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/multiple-button.gif -------------------------------------------------------------------------------- /docs/images/portal-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/portal-min.gif -------------------------------------------------------------------------------- /docs/images/portal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/portal.gif -------------------------------------------------------------------------------- /docs/images/ribbon-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ribbon-min.gif -------------------------------------------------------------------------------- /docs/images/ribbon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/ribbon.gif -------------------------------------------------------------------------------- /docs/images/save_button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/save_button-min.gif -------------------------------------------------------------------------------- /docs/images/save_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/save_button.gif -------------------------------------------------------------------------------- /docs/images/screen-hover-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/screen-hover-min.gif -------------------------------------------------------------------------------- /docs/images/screen-hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/screen-hover.gif -------------------------------------------------------------------------------- /docs/images/screen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/screen-min.gif -------------------------------------------------------------------------------- /docs/images/screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/screen.gif -------------------------------------------------------------------------------- /docs/images/scroll-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/scroll-min.gif -------------------------------------------------------------------------------- /docs/images/scroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/scroll.gif -------------------------------------------------------------------------------- /docs/images/sheen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/sheen-min.gif -------------------------------------------------------------------------------- /docs/images/sheen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/sheen.gif -------------------------------------------------------------------------------- /docs/images/simple-keyframes-alternating-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/simple-keyframes-alternating-min.gif -------------------------------------------------------------------------------- /docs/images/simple-keyframes-alternating.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/simple-keyframes-alternating.gif -------------------------------------------------------------------------------- /docs/images/simple-keyframes-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/simple-keyframes-min.gif -------------------------------------------------------------------------------- /docs/images/simple-keyframes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/simple-keyframes.gif -------------------------------------------------------------------------------- /docs/images/sprout-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/sprout-min.gif -------------------------------------------------------------------------------- /docs/images/sprout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/sprout.gif -------------------------------------------------------------------------------- /docs/images/starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/starwars-min.gif -------------------------------------------------------------------------------- /docs/images/starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/starwars.gif -------------------------------------------------------------------------------- /docs/images/starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/starwars.png -------------------------------------------------------------------------------- /docs/images/steps-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/steps-min.gif -------------------------------------------------------------------------------- /docs/images/steps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/steps.gif -------------------------------------------------------------------------------- /docs/images/steps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/steps.png -------------------------------------------------------------------------------- /docs/images/traffic-light-grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/traffic-light-grid.png -------------------------------------------------------------------------------- /docs/images/traffic-lights-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/traffic-lights-min.gif -------------------------------------------------------------------------------- /docs/images/traffic-lights.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/traffic-lights.gif -------------------------------------------------------------------------------- /docs/images/transitions-animations-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/transitions-animations-min.gif -------------------------------------------------------------------------------- /docs/images/transitions-animations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/transitions-animations.gif -------------------------------------------------------------------------------- /docs/images/transitions-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/transitions-min.gif -------------------------------------------------------------------------------- /docs/images/transitions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/transitions.gif -------------------------------------------------------------------------------- /docs/images/wiggle-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/wiggle-min.gif -------------------------------------------------------------------------------- /docs/images/wiggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/wiggle.gif -------------------------------------------------------------------------------- /docs/images/winnie-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/winnie-min.gif -------------------------------------------------------------------------------- /docs/images/winnie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/docs/images/winnie.gif -------------------------------------------------------------------------------- /docs/style.css: -------------------------------------------------------------------------------- 1 | 2 | html { 3 | font-size: 100%; 4 | overflow-y: scroll; 5 | -webkit-text-size-adjust: 100%; 6 | -ms-text-size-adjust: 100%; 7 | } 8 | 9 | body { 10 | color: #444; 11 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; 12 | font-size: 12px; 13 | line-height: 1.7; 14 | padding: 1em; 15 | margin: auto; 16 | max-width: 42em; 17 | background: #fefefe; 18 | } 19 | 20 | a { 21 | color: #0645ad; 22 | text-decoration: none; 23 | } 24 | 25 | a:visited { 26 | color: #0b0080; 27 | } 28 | 29 | a:hover { 30 | color: #06e; 31 | } 32 | 33 | a:active { 34 | color: #faa700; 35 | } 36 | 37 | a:focus { 38 | outline: thin dotted; 39 | } 40 | 41 | *::-moz-selection { 42 | background: rgba(255, 255, 0, 0.3); 43 | color: #000; 44 | } 45 | 46 | *::selection { 47 | background: rgba(255, 255, 0, 0.3); 48 | color: #000; 49 | } 50 | 51 | a::-moz-selection { 52 | background: rgba(255, 255, 0, 0.3); 53 | color: #0645ad; 54 | } 55 | 56 | a::selection { 57 | background: rgba(255, 255, 0, 0.3); 58 | color: #0645ad; 59 | } 60 | 61 | p { 62 | margin: 1em 0; 63 | } 64 | 65 | img { 66 | max-width: 100%; 67 | } 68 | 69 | h1, h2, h3, h4, h5, h6 { 70 | color: #111; 71 | line-height: 125%; 72 | margin-top: 2em; 73 | font-weight: normal; 74 | } 75 | 76 | h4, h5, h6 { 77 | font-weight: bold; 78 | } 79 | 80 | h1 { 81 | font-size: 2.5em; 82 | } 83 | 84 | h2 { 85 | font-size: 2em; 86 | } 87 | 88 | h3 { 89 | font-size: 1.5em; 90 | } 91 | 92 | h4 { 93 | font-size: 1.2em; 94 | } 95 | 96 | h5 { 97 | font-size: 1em; 98 | } 99 | 100 | h6 { 101 | font-size: 0.9em; 102 | } 103 | 104 | blockquote { 105 | color: #666666; 106 | margin: 0; 107 | padding-left: 3em; 108 | border-left: 0.5em #EEE solid; 109 | } 110 | 111 | hr { 112 | display: block; 113 | height: 2px; 114 | border: 0; 115 | border-top: 1px solid #aaa; 116 | border-bottom: 1px solid #eee; 117 | margin: 1em 0; 118 | padding: 0; 119 | } 120 | 121 | pre, code, kbd, samp { 122 | color: #000; 123 | font-family: monospace, monospace; 124 | _font-family: 'courier new', monospace; 125 | font-size: 0.98em; 126 | } 127 | 128 | pre { 129 | white-space: pre; 130 | white-space: pre-wrap; 131 | word-wrap: break-word; 132 | } 133 | 134 | b, strong { 135 | font-weight: bold; 136 | } 137 | 138 | dfn { 139 | font-style: italic; 140 | } 141 | 142 | ins { 143 | background: #ff9; 144 | color: #000; 145 | text-decoration: none; 146 | } 147 | 148 | mark { 149 | background: #ff0; 150 | color: #000; 151 | font-style: italic; 152 | font-weight: bold; 153 | } 154 | 155 | sub, sup { 156 | font-size: 75%; 157 | line-height: 0; 158 | position: relative; 159 | vertical-align: baseline; 160 | } 161 | 162 | sup { 163 | top: -0.5em; 164 | } 165 | 166 | sub { 167 | bottom: -0.25em; 168 | } 169 | 170 | ul, ol { 171 | margin: 1em 0; 172 | padding: 0 0 0 2em; 173 | } 174 | 175 | li p:last-child { 176 | margin-bottom: 0; 177 | } 178 | 179 | ul ul, ol ol { 180 | margin: .3em 0; 181 | } 182 | 183 | dl { 184 | margin-bottom: 1em; 185 | } 186 | 187 | dt { 188 | font-weight: bold; 189 | margin-bottom: .8em; 190 | } 191 | 192 | dd { 193 | margin: 0 0 .8em 2em; 194 | } 195 | 196 | dd:last-child { 197 | margin-bottom: 0; 198 | } 199 | 200 | img { 201 | border: 0; 202 | -ms-interpolation-mode: bicubic; 203 | vertical-align: middle; 204 | } 205 | 206 | figure { 207 | display: block; 208 | text-align: center; 209 | margin: 1em 0; 210 | } 211 | 212 | figure img { 213 | border: none; 214 | margin: 0 auto; 215 | } 216 | 217 | figcaption { 218 | font-size: 0.8em; 219 | font-style: italic; 220 | margin: 0 0 .8em; 221 | } 222 | 223 | table { 224 | margin-bottom: 2em; 225 | border-bottom: 1px solid #ddd; 226 | border-right: 1px solid #ddd; 227 | border-spacing: 0; 228 | border-collapse: collapse; 229 | } 230 | 231 | table th { 232 | padding: .2em 1em; 233 | background-color: #eee; 234 | border-top: 1px solid #ddd; 235 | border-left: 1px solid #ddd; 236 | } 237 | 238 | table td { 239 | padding: .2em 1em; 240 | border-top: 1px solid #ddd; 241 | border-left: 1px solid #ddd; 242 | vertical-align: top; 243 | } 244 | 245 | .author { 246 | font-size: 1.2em; 247 | text-align: center; 248 | } 249 | 250 | @media only screen and (min-width: 480px) { 251 | body { 252 | font-size: 14px; 253 | } 254 | } 255 | @media only screen and (min-width: 768px) { 256 | body { 257 | font-size: 16px; 258 | } 259 | } 260 | @media print { 261 | * { 262 | background: transparent !important; 263 | color: black !important; 264 | filter: none !important; 265 | -ms-filter: none !important; 266 | } 267 | 268 | body { 269 | font-size: 12pt; 270 | max-width: 100%; 271 | } 272 | 273 | a, a:visited { 274 | text-decoration: underline; 275 | } 276 | 277 | hr { 278 | height: 1px; 279 | border: 0; 280 | border-bottom: 1px solid black; 281 | } 282 | 283 | a[href]:after { 284 | content: " (" attr(href) ")"; 285 | } 286 | 287 | abbr[title]:after { 288 | content: " (" attr(title) ")"; 289 | } 290 | 291 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { 292 | content: ""; 293 | } 294 | 295 | pre, blockquote { 296 | border: 1px solid #999; 297 | padding-right: 1em; 298 | page-break-inside: avoid; 299 | } 300 | 301 | tr, img { 302 | page-break-inside: avoid; 303 | } 304 | 305 | img { 306 | max-width: 100% !important; 307 | } 308 | 309 | @page :left { 310 | margin: 15mm 20mm 15mm 10mm; 311 | } 312 | 313 | @page :right { 314 | margin: 15mm 10mm 15mm 20mm; 315 | } 316 | 317 | p, h2, h3 { 318 | orphans: 3; 319 | widows: 3; 320 | } 321 | 322 | h2, h3 { 323 | page-break-after: avoid; 324 | } 325 | } 326 | -------------------------------------------------------------------------------- /images/ab-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ab-min.gif -------------------------------------------------------------------------------- /images/ab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ab.gif -------------------------------------------------------------------------------- /images/ab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ab.jpg -------------------------------------------------------------------------------- /images/ab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ab.png -------------------------------------------------------------------------------- /images/ab_animated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ab_animated.png -------------------------------------------------------------------------------- /images/abc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/abc.png -------------------------------------------------------------------------------- /images/animation-fill-mode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/animation-fill-mode.gif -------------------------------------------------------------------------------- /images/animators_survival_kit_frame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/animators_survival_kit_frame.jpg -------------------------------------------------------------------------------- /images/baymax-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/baymax-min.gif -------------------------------------------------------------------------------- /images/baymax.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/baymax.gif -------------------------------------------------------------------------------- /images/baymax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/baymax.png -------------------------------------------------------------------------------- /images/button-element-positioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/button-element-positioning.png -------------------------------------------------------------------------------- /images/button-element-positioning2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/button-element-positioning2.png -------------------------------------------------------------------------------- /images/button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/button-min.gif -------------------------------------------------------------------------------- /images/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/button.gif -------------------------------------------------------------------------------- /images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/button.png -------------------------------------------------------------------------------- /images/cat-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cat-min.gif -------------------------------------------------------------------------------- /images/cat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cat.gif -------------------------------------------------------------------------------- /images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cat.png -------------------------------------------------------------------------------- /images/change-background-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/change-background-min.gif -------------------------------------------------------------------------------- /images/change-background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/change-background.gif -------------------------------------------------------------------------------- /images/change-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/change-background.png -------------------------------------------------------------------------------- /images/course-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/course-min.gif -------------------------------------------------------------------------------- /images/course.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/course.gif -------------------------------------------------------------------------------- /images/course.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/course.png -------------------------------------------------------------------------------- /images/cover-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cover-small.png -------------------------------------------------------------------------------- /images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cover.png -------------------------------------------------------------------------------- /images/css-starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/css-starwars-min.gif -------------------------------------------------------------------------------- /images/css-starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/css-starwars.gif -------------------------------------------------------------------------------- /images/css-starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/css-starwars.png -------------------------------------------------------------------------------- /images/cubic-bezier-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cubic-bezier-graph.png -------------------------------------------------------------------------------- /images/cubic-bezier-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cubic-bezier-min.gif -------------------------------------------------------------------------------- /images/cubic-bezier.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cubic-bezier.gif -------------------------------------------------------------------------------- /images/cubic-bezier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/cubic-bezier.png -------------------------------------------------------------------------------- /images/demo-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/demo-min.gif -------------------------------------------------------------------------------- /images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/demo.gif -------------------------------------------------------------------------------- /images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/demo.png -------------------------------------------------------------------------------- /images/donovan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/donovan.jpg -------------------------------------------------------------------------------- /images/donovan_hutchinson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/donovan_hutchinson.jpg -------------------------------------------------------------------------------- /images/ease-in-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-in-min.gif -------------------------------------------------------------------------------- /images/ease-in-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-in-out-min.gif -------------------------------------------------------------------------------- /images/ease-in-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-in-out.gif -------------------------------------------------------------------------------- /images/ease-in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-in.gif -------------------------------------------------------------------------------- /images/ease-out-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-out-min.gif -------------------------------------------------------------------------------- /images/ease-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ease-out.gif -------------------------------------------------------------------------------- /images/fabric-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/fabric-min.gif -------------------------------------------------------------------------------- /images/fabric.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/fabric.gif -------------------------------------------------------------------------------- /images/files.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/files.jpg -------------------------------------------------------------------------------- /images/js-triggered-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/js-triggered-button-min.gif -------------------------------------------------------------------------------- /images/js-triggered-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/js-triggered-button.gif -------------------------------------------------------------------------------- /images/linear-example-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/linear-example-min.gif -------------------------------------------------------------------------------- /images/linear-example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/linear-example.gif -------------------------------------------------------------------------------- /images/linear-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/linear-min.gif -------------------------------------------------------------------------------- /images/linear.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/linear.gif -------------------------------------------------------------------------------- /images/list_item-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/list_item-min.gif -------------------------------------------------------------------------------- /images/list_item.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/list_item.gif -------------------------------------------------------------------------------- /images/macplus-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/macplus-min.gif -------------------------------------------------------------------------------- /images/macplus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/macplus.gif -------------------------------------------------------------------------------- /images/mailchimp-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/mailchimp-min.gif -------------------------------------------------------------------------------- /images/mailchimp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/mailchimp.gif -------------------------------------------------------------------------------- /images/multiple-button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/multiple-button-min.gif -------------------------------------------------------------------------------- /images/multiple-button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/multiple-button.gif -------------------------------------------------------------------------------- /images/portal-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/portal-min.gif -------------------------------------------------------------------------------- /images/portal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/portal.gif -------------------------------------------------------------------------------- /images/ribbon-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ribbon-min.gif -------------------------------------------------------------------------------- /images/ribbon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/ribbon.gif -------------------------------------------------------------------------------- /images/save_button-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/save_button-min.gif -------------------------------------------------------------------------------- /images/save_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/save_button.gif -------------------------------------------------------------------------------- /images/screen-hover-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/screen-hover-min.gif -------------------------------------------------------------------------------- /images/screen-hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/screen-hover.gif -------------------------------------------------------------------------------- /images/screen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/screen-min.gif -------------------------------------------------------------------------------- /images/screen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/screen.gif -------------------------------------------------------------------------------- /images/scroll-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/scroll-min.gif -------------------------------------------------------------------------------- /images/scroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/scroll.gif -------------------------------------------------------------------------------- /images/sheen-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/sheen-min.gif -------------------------------------------------------------------------------- /images/sheen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/sheen.gif -------------------------------------------------------------------------------- /images/simple-keyframes-alternating-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/simple-keyframes-alternating-min.gif -------------------------------------------------------------------------------- /images/simple-keyframes-alternating.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/simple-keyframes-alternating.gif -------------------------------------------------------------------------------- /images/simple-keyframes-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/simple-keyframes-min.gif -------------------------------------------------------------------------------- /images/simple-keyframes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/simple-keyframes.gif -------------------------------------------------------------------------------- /images/sprout-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/sprout-min.gif -------------------------------------------------------------------------------- /images/sprout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/sprout.gif -------------------------------------------------------------------------------- /images/starwars-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/starwars-min.gif -------------------------------------------------------------------------------- /images/starwars.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/starwars.gif -------------------------------------------------------------------------------- /images/starwars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/starwars.png -------------------------------------------------------------------------------- /images/steps-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/steps-min.gif -------------------------------------------------------------------------------- /images/steps.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/steps.gif -------------------------------------------------------------------------------- /images/steps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/steps.png -------------------------------------------------------------------------------- /images/traffic-light-grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/traffic-light-grid.png -------------------------------------------------------------------------------- /images/traffic-lights-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/traffic-lights-min.gif -------------------------------------------------------------------------------- /images/traffic-lights.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/traffic-lights.gif -------------------------------------------------------------------------------- /images/transitions-animations-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/transitions-animations-min.gif -------------------------------------------------------------------------------- /images/transitions-animations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/transitions-animations.gif -------------------------------------------------------------------------------- /images/transitions-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/transitions-min.gif -------------------------------------------------------------------------------- /images/transitions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/transitions.gif -------------------------------------------------------------------------------- /images/wiggle-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/wiggle-min.gif -------------------------------------------------------------------------------- /images/wiggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/wiggle.gif -------------------------------------------------------------------------------- /images/winnie-min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/winnie-min.gif -------------------------------------------------------------------------------- /images/winnie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/H-Wakanda/css-animation-101-cn/9a161d5fec7c804b12e18b16b1996799026f0892/images/winnie.gif -------------------------------------------------------------------------------- /metadata.yml: -------------------------------------------------------------------------------- 1 | --- 2 | title: CSS Animation 101 3 | author: Donovan Hutchinson 4 | rights: Creative Commons Attribution 4.0 International 5 | language: en-US 6 | tags: [css animation, html, css, web development] 7 | abstract: | 8 | Learn how to add animation to your web projects 9 | --- 10 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | 2 | html { 3 | font-size: 100%; 4 | overflow-y: scroll; 5 | -webkit-text-size-adjust: 100%; 6 | -ms-text-size-adjust: 100%; 7 | } 8 | 9 | body { 10 | color: #444; 11 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; 12 | font-size: 12px; 13 | line-height: 1.7; 14 | padding: 1em; 15 | margin: auto; 16 | max-width: 42em; 17 | background: #fefefe; 18 | } 19 | 20 | a { 21 | color: #0645ad; 22 | text-decoration: none; 23 | } 24 | 25 | a:visited { 26 | color: #0b0080; 27 | } 28 | 29 | a:hover { 30 | color: #06e; 31 | } 32 | 33 | a:active { 34 | color: #faa700; 35 | } 36 | 37 | a:focus { 38 | outline: thin dotted; 39 | } 40 | 41 | *::-moz-selection { 42 | background: rgba(255, 255, 0, 0.3); 43 | color: #000; 44 | } 45 | 46 | *::selection { 47 | background: rgba(255, 255, 0, 0.3); 48 | color: #000; 49 | } 50 | 51 | a::-moz-selection { 52 | background: rgba(255, 255, 0, 0.3); 53 | color: #0645ad; 54 | } 55 | 56 | a::selection { 57 | background: rgba(255, 255, 0, 0.3); 58 | color: #0645ad; 59 | } 60 | 61 | p { 62 | margin: 1em 0; 63 | } 64 | 65 | img { 66 | max-width: 100%; 67 | } 68 | 69 | h1, h2, h3, h4, h5, h6 { 70 | color: #111; 71 | line-height: 125%; 72 | margin-top: 2em; 73 | font-weight: normal; 74 | } 75 | 76 | h4, h5, h6 { 77 | font-weight: bold; 78 | } 79 | 80 | h1 { 81 | font-size: 2.5em; 82 | } 83 | 84 | h2 { 85 | font-size: 2em; 86 | } 87 | 88 | h3 { 89 | font-size: 1.5em; 90 | } 91 | 92 | h4 { 93 | font-size: 1.2em; 94 | } 95 | 96 | h5 { 97 | font-size: 1em; 98 | } 99 | 100 | h6 { 101 | font-size: 0.9em; 102 | } 103 | 104 | blockquote { 105 | color: #666666; 106 | margin: 0; 107 | padding-left: 3em; 108 | border-left: 0.5em #EEE solid; 109 | } 110 | 111 | hr { 112 | display: block; 113 | height: 2px; 114 | border: 0; 115 | border-top: 1px solid #aaa; 116 | border-bottom: 1px solid #eee; 117 | margin: 1em 0; 118 | padding: 0; 119 | } 120 | 121 | pre, code, kbd, samp { 122 | color: #000; 123 | font-family: monospace, monospace; 124 | _font-family: 'courier new', monospace; 125 | font-size: 0.98em; 126 | } 127 | 128 | pre { 129 | white-space: pre; 130 | white-space: pre-wrap; 131 | word-wrap: break-word; 132 | } 133 | 134 | b, strong { 135 | font-weight: bold; 136 | } 137 | 138 | dfn { 139 | font-style: italic; 140 | } 141 | 142 | ins { 143 | background: #ff9; 144 | color: #000; 145 | text-decoration: none; 146 | } 147 | 148 | mark { 149 | background: #ff0; 150 | color: #000; 151 | font-style: italic; 152 | font-weight: bold; 153 | } 154 | 155 | sub, sup { 156 | font-size: 75%; 157 | line-height: 0; 158 | position: relative; 159 | vertical-align: baseline; 160 | } 161 | 162 | sup { 163 | top: -0.5em; 164 | } 165 | 166 | sub { 167 | bottom: -0.25em; 168 | } 169 | 170 | ul, ol { 171 | margin: 1em 0; 172 | padding: 0 0 0 2em; 173 | } 174 | 175 | li p:last-child { 176 | margin-bottom: 0; 177 | } 178 | 179 | ul ul, ol ol { 180 | margin: .3em 0; 181 | } 182 | 183 | dl { 184 | margin-bottom: 1em; 185 | } 186 | 187 | dt { 188 | font-weight: bold; 189 | margin-bottom: .8em; 190 | } 191 | 192 | dd { 193 | margin: 0 0 .8em 2em; 194 | } 195 | 196 | dd:last-child { 197 | margin-bottom: 0; 198 | } 199 | 200 | img { 201 | border: 0; 202 | -ms-interpolation-mode: bicubic; 203 | vertical-align: middle; 204 | } 205 | 206 | figure { 207 | display: block; 208 | text-align: center; 209 | margin: 1em 0; 210 | } 211 | 212 | figure img { 213 | border: none; 214 | margin: 0 auto; 215 | } 216 | 217 | figcaption { 218 | font-size: 0.8em; 219 | font-style: italic; 220 | margin: 0 0 .8em; 221 | } 222 | 223 | table { 224 | margin-bottom: 2em; 225 | border-bottom: 1px solid #ddd; 226 | border-right: 1px solid #ddd; 227 | border-spacing: 0; 228 | border-collapse: collapse; 229 | } 230 | 231 | table th { 232 | padding: .2em 1em; 233 | background-color: #eee; 234 | border-top: 1px solid #ddd; 235 | border-left: 1px solid #ddd; 236 | } 237 | 238 | table td { 239 | padding: .2em 1em; 240 | border-top: 1px solid #ddd; 241 | border-left: 1px solid #ddd; 242 | vertical-align: top; 243 | } 244 | 245 | .author { 246 | font-size: 1.2em; 247 | text-align: center; 248 | } 249 | 250 | @media only screen and (min-width: 480px) { 251 | body { 252 | font-size: 14px; 253 | } 254 | } 255 | @media only screen and (min-width: 768px) { 256 | body { 257 | font-size: 16px; 258 | } 259 | } 260 | @media print { 261 | * { 262 | background: transparent !important; 263 | color: black !important; 264 | filter: none !important; 265 | -ms-filter: none !important; 266 | } 267 | 268 | body { 269 | font-size: 12pt; 270 | max-width: 100%; 271 | } 272 | 273 | a, a:visited { 274 | text-decoration: underline; 275 | } 276 | 277 | hr { 278 | height: 1px; 279 | border: 0; 280 | border-bottom: 1px solid black; 281 | } 282 | 283 | a[href]:after { 284 | content: " (" attr(href) ")"; 285 | } 286 | 287 | abbr[title]:after { 288 | content: " (" attr(title) ")"; 289 | } 290 | 291 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { 292 | content: ""; 293 | } 294 | 295 | pre, blockquote { 296 | border: 1px solid #999; 297 | padding-right: 1em; 298 | page-break-inside: avoid; 299 | } 300 | 301 | tr, img { 302 | page-break-inside: avoid; 303 | } 304 | 305 | img { 306 | max-width: 100% !important; 307 | } 308 | 309 | @page :left { 310 | margin: 15mm 20mm 15mm 10mm; 311 | } 312 | 313 | @page :right { 314 | margin: 15mm 10mm 15mm 20mm; 315 | } 316 | 317 | p, h2, h3 { 318 | orphans: 3; 319 | widows: 3; 320 | } 321 | 322 | h2, h3 { 323 | page-break-after: avoid; 324 | } 325 | } 326 | --------------------------------------------------------------------------------