Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
Coding Tree
提交
e3be4d4a
C
Coding Tree
项目概览
檀越@新空间
/
Coding Tree
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coding Tree
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e3be4d4a
编写于
2月 14, 2022
作者:
彭世瑜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
7e6d36f1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
177 addition
and
2 deletion
+177
-2
blog/front-end-combat/animation.md
blog/front-end-combat/animation.md
+70
-0
blog/front-end-combat/demo/animation-1.html
blog/front-end-combat/demo/animation-1.html
+25
-0
blog/front-end-combat/demo/animation-2.html
blog/front-end-combat/demo/animation-2.html
+71
-0
blog/front-end-combat/index.md
blog/front-end-combat/index.md
+3
-1
blog/front-end-combat/transform-3d.md
blog/front-end-combat/transform-3d.md
+8
-1
未找到文件。
blog/front-end-combat/animation.md
0 → 100644
浏览文件 @
e3be4d4a
# 动画 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
blog/front-end-combat/demo/animation-1.html
0 → 100644
浏览文件 @
e3be4d4a
<style>
.box
{
width
:
50px
;
height
:
50px
;
background-color
:
skyblue
;
}
.box
:hover
{
/* 使用动画 */
animation
:
change-width
2s
;
}
/* 定义动画 */
@keyframes
change-width
{
from
{
width
:
50px
;
}
to
{
width
:
200px
;
}
}
</style>
<div
class=
"box"
></div>
\ No newline at end of file
blog/front-end-combat/demo/animation-2.html
0 → 100644
浏览文件 @
e3be4d4a
<style>
.box
{
width
:
50px
;
height
:
50px
;
line-height
:
50px
;
text-align
:
center
;
background-color
:
skyblue
;
}
/* 基本动画 */
.box-basic
{
animation
:
change-width
2s
;
}
/* 匀速动画 */
.box-linear
{
animation
:
change-width
2s
linear
;
}
/* 分步动画 */
.box-steps
{
animation
:
change-width
2s
steps
(
3
);
}
/* 延迟动画 */
.box-delay
{
animation
:
change-width
2s
2s
;
}
/* 重复3次 */
.box-repeat
{
animation
:
change-width
2s
3
;
}
/* 无限循环 */
.box-infinite
{
animation
:
change-width
2s
infinite
;
}
/* 反向动画 */
.box-alternate
{
animation
:
change-width
2s
infinite
alternate
;
}
/* 动画停留在最初状态 backwards */
/* 动画停留在最后状态 forwards */
.box-forwards
{
animation
:
change-width
2s
forwards
;
}
/* 定义动画 */
@keyframes
change-width
{
from
{
width
:
50px
;
}
to
{
width
:
200px
;
}
}
</style>
<div
class=
"box box-basic"
>
basic
</div>
<div
class=
"box box-linear"
>
linear
</div>
<div
class=
"box box-steps"
>
steps
</div>
<div
class=
"box box-delay"
>
delay
</div>
<div
class=
"box box-repeat"
>
repeat
</div>
<div
class=
"box box-infinite"
>
infinite
</div>
<div
class=
"box box-alternate"
>
alternate
</div>
<div
class=
"box box-forwards"
>
forwards
</div>
\ No newline at end of file
blog/front-end-combat/index.md
浏览文件 @
e3be4d4a
...
@@ -6,7 +6,9 @@
...
@@ -6,7 +6,9 @@
2.
[
平面转换 transform
](
blog/front-end-combat/transform.md
)
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 平面、渐变、动画属性
-
css3 平面、渐变、动画属性
-
Flex 布局
-
Flex 布局
...
...
blog/front-end-combat/transform-3d.md
浏览文件 @
e3be4d4a
...
@@ -110,4 +110,11 @@ perspective: 像素值; /* (800-1200) */
...
@@ -110,4 +110,11 @@ perspective: 像素值; /* (800-1200) */
transform-style
:
preserve-3d
;
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
);
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录