diff --git a/blog/front-end-combat/animation.md b/blog/front-end-combat/animation.md new file mode 100644 index 0000000000000000000000000000000000000000..0eff7c4294a0dd5ff0211ffd124bd0c89aba8f99 --- /dev/null +++ b/blog/front-end-combat/animation.md @@ -0,0 +1,70 @@ +# 动画 animation + +过渡 vs 动画 + +- 过渡:用于两个状态变化过程 +- 动画:实现多个状态间的变化过程,动画过程可控 + +动画 + +- 动画的本质:快速切换大量图片时在人脑中行成的具有连续性的画面 +- 构成动画的最小单元:帧或动画帧 + +实现步骤: + +1. 定义动画 + +```css +/* 定义两种状态 */ +@keyframes 动画名称 { + from { + } + to { + } +} + +/* 定义多种状态 */ +/* 百分比表示动画总时长的占比 */ +@keyframes 动画名称 { + 0% { + } + 10% { + } + 50% { + } + 100% { + } +} +``` + +2. 使用动画 + +```css +animation: 动画名称 动画花费时长; +``` + +示例: + +[](demo/animation-1.html ':include :type=code') + +[](demo/animation-1.html ':include height=70') + +## 动画属性 + +```css +animation: 动画名称 动画时长 速度曲线 延迟时间 重复次数 动画方向 执行完毕时状态; +``` + +注意: + +- 动画名称 和 动画时长必须赋值 +- 取值不分先后顺序 +- 如果有 2 个时间值,第一个时间表示动画时长,第二个时间表示延迟时间 + +示例: + +[](demo/animation-2.html ':include :type=code') + +[](demo/animation-2.html ':include height=420') + +https://www.bilibili.com/video/BV1xq4y1q7jZ?p=45&spm_id_from=pageDriver diff --git a/blog/front-end-combat/demo/animation-1.html b/blog/front-end-combat/demo/animation-1.html new file mode 100644 index 0000000000000000000000000000000000000000..bbec563a5325bdcb2c11e1f0e1515ea4b771c608 --- /dev/null +++ b/blog/front-end-combat/demo/animation-1.html @@ -0,0 +1,25 @@ + + +
\ No newline at end of file diff --git a/blog/front-end-combat/demo/animation-2.html b/blog/front-end-combat/demo/animation-2.html new file mode 100644 index 0000000000000000000000000000000000000000..671839e5ed3e26e5f05dd69608c70617038306c8 --- /dev/null +++ b/blog/front-end-combat/demo/animation-2.html @@ -0,0 +1,71 @@ + + + +
basic
+
linear
+
steps
+
delay
+
repeat
+
infinite
+
alternate
+
forwards
\ No newline at end of file diff --git a/blog/front-end-combat/index.md b/blog/front-end-combat/index.md index fbfdbb3ee418ea9fec4f9243df2d6722808a324d..6a6cc506259c3ba3b06bd9e567e39050a85f632e 100644 --- a/blog/front-end-combat/index.md +++ b/blog/front-end-combat/index.md @@ -6,7 +6,9 @@ 2. [平面转换 transform](blog/front-end-combat/transform.md) -3. [空间转换 transform](blog/front-end-combat/transform-3d.md) +3. [空间转换 transform 3d](blog/front-end-combat/transform-3d.md) + +4. [动画 animation](blog/front-end-combat/animation.md) - css3 平面、渐变、动画属性 - Flex 布局 diff --git a/blog/front-end-combat/transform-3d.md b/blog/front-end-combat/transform-3d.md index 8462ba26198f45f9239bc2f6334a3d3350b5317e..8d54cbb319d2b58f1f93bbbefc4947e3d1ef02e6 100644 --- a/blog/front-end-combat/transform-3d.md +++ b/blog/front-end-combat/transform-3d.md @@ -110,4 +110,11 @@ perspective: 像素值; /* (800-1200) */ transform-style: preserve-3d; ``` -https://www.bilibili.com/video/BV1xq4y1q7jZ?p=39&spm_id_from=pageDriver +# 空间缩放 scale + +```css +transform: scaleX(x); +transform: scaleY(y); +transform: scaleZ(z); +transform: scale3d(x, y, z); +```