2015-07-28 12:33:09 +08:00
|
|
|
|
# EnterAnimation
|
2015-07-28 12:32:27 +08:00
|
|
|
|
|
|
|
|
|
- order: 11
|
|
|
|
|
- category: Components
|
|
|
|
|
- chinese: 进场动画
|
2015-07-28 15:16:51 +08:00
|
|
|
|
- cols: 1
|
2015-07-28 12:32:27 +08:00
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
页面进场离场的动画。
|
|
|
|
|
|
|
|
|
|
## 何时使用
|
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
- 从内容A到内容B的转变过程时能有效的吸引用户注意力,突出视觉中心,提高整体视觉效果。
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
- 小的信息元素排布或块状较多的情况下,根据一定的路径层次依次进场,区分维度层级,来凸显量级,使页面转场更加流畅和舒适,提高整体视觉效果和产品的质感。
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
2015-07-28 12:32:27 +08:00
|
|
|
|
## API
|
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
```jsx
|
|
|
|
|
<EnterAnimation>
|
|
|
|
|
<div>依次进场</div>
|
|
|
|
|
<div>依次进场</div>
|
|
|
|
|
<div>依次进场</div>
|
|
|
|
|
<div>依次进场</div>
|
|
|
|
|
</EnterAnimation>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
|
<EnterAnimation type="left" delay={2}>
|
|
|
|
|
<div>
|
|
|
|
|
<div enter-data>
|
|
|
|
|
依次进场
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div enter-data>依次进场</div>
|
|
|
|
|
<div enter-data={{type: 'bottom'}}>依次进场,并修改动画效果</div>
|
|
|
|
|
<div>没有动画</div>
|
|
|
|
|
</EnterAnimation>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
如子节点有 `enter-data` 值,则只执行有 `enter-data` 的节点的动画,相反所有子节点上都没有 `enter-data` 值,则执行遍历dom下一级节点来执行动画。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### <EnterAnimation />
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
|
|
|
|
|参数 |类型 |默认值 |详细 |
|
|
|
|
|
|-----------------|-------|-------------|----------------------------------------------------|
|
2015-07-29 12:17:18 +08:00
|
|
|
|
|type |string |`right` |执行动画的内置参数 |
|
|
|
|
|
|style |string |null |同上, style 的样式动画, `type` 有值,此项无效|
|
2015-07-28 15:42:43 +08:00
|
|
|
|
|delay |number |0 |整个区块的延时,以秒为单位|
|
|
|
|
|
|interval |number |0.1 |递增延时值,以秒为单位|
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
### enter-data
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
|
|
|
|
|参数 |类型 |默认值 |详细 |
|
|
|
|
|
|-----------------|-------|-----------|----------------------------------------------------|
|
2015-07-29 12:17:18 +08:00
|
|
|
|
|enter-data |object | `right` |子标签动画参数|
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
#### enter-data={}
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
|参数 |类型 |默认值 |详细 |
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|-----------------|-----------------|----------------|----------------------------------------------------|
|
2015-07-29 12:17:18 +08:00
|
|
|
|
|type |string |`right` |内置动画样式:<br/> `alpha` `left` `right` `top` `bottom` `scale` `scaleBig` `scaleX` `scaleY`|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
|style |string |null |动画样式,如 `transform: translateX(100px)`,`type` 有值此项无效|
|
2015-07-29 12:17:18 +08:00
|
|
|
|
|direction |string |`enter` |动画进出场方向:`enter` `leave`|
|
2015-07-28 15:42:43 +08:00
|
|
|
|
|duration |number |0.5 |动画的时间,以秒为单位|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
|ease |string |`cubic-bezier(0.165, 0.84, 0.44, 1)`|样式缓动,只支持 css 样式缓动|
|
|
|
|
|
|delay |number |0 |动画的延时,依照结构递增以上的 `interval`|
|
2015-07-28 15:16:51 +08:00
|
|
|
|
|queueId |number |0 |动画的线程|
|
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
<style>
|
|
|
|
|
.code-box-demo .demo-header {
|
|
|
|
|
width: 100%;
|
|
|
|
|
background: #ebedee;
|
|
|
|
|
height: 30px;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header ul {
|
|
|
|
|
float: right;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-right: 5px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header ul li {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 50px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
height: 30px;
|
|
|
|
|
float: left;
|
|
|
|
|
background: #e4e4e4;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-left: 5px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header ul li:before {
|
|
|
|
|
margin: 10px auto;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 20px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
height: 10px;
|
|
|
|
|
background: #ebeded;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header .logo {
|
|
|
|
|
float: left;
|
|
|
|
|
margin: 0px auto 0 10px;
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header .logo img{
|
|
|
|
|
margin:auto
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header .logo span {
|
|
|
|
|
display: block;
|
|
|
|
|
float: right;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content {
|
|
|
|
|
width: 80%;
|
|
|
|
|
margin: 10px auto;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-title {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
text-align:left;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
background: #a4a4a4;
|
|
|
|
|
width: 40%;
|
|
|
|
|
height: 20px;
|
|
|
|
|
line-height: 20px;
|
|
|
|
|
color: #ebeded;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
text-indent:10px
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list .title {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
height: 30px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
background: #cacaca;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
2015-07-29 12:17:18 +08:00
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list .title:before,.code-box-demo .demo-content .demo-listBox .demo-list .title:after{
|
|
|
|
|
width: 30%;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
height: 5px;
|
|
|
|
|
background: #ebeded;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
float:left;
|
|
|
|
|
margin:12px 35px 0;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list .title:after{
|
|
|
|
|
width:15%;
|
|
|
|
|
float:right;
|
|
|
|
|
margin:12px 10px 0;
|
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list ul li {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
height: 25px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
background: #ebeded;
|
|
|
|
|
border-bottom: 1px solid #cacaca;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
padding: 5px 15px;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list ul li:before {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 10px;
|
|
|
|
|
height: 5px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
background: #cacaca;
|
|
|
|
|
float: left;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-top:4px
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list ul li:after {
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 50%;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
height: 5px;
|
|
|
|
|
background: #cacaca;
|
|
|
|
|
float: left;
|
|
|
|
|
margin-left: 10px;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-top: 4px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-kp {
|
|
|
|
|
margin: 10px auto;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li {
|
|
|
|
|
display: inline-block;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 32%;
|
|
|
|
|
height: 40px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
background: #cacaca;
|
|
|
|
|
color: #ebeded;
|
|
|
|
|
text-align: left;
|
|
|
|
|
padding: 10px;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-right: calc(2%);
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li:last-child {
|
|
|
|
|
margin-right: 0%;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li:after {
|
|
|
|
|
width: 60%;
|
|
|
|
|
height: 5px;
|
|
|
|
|
background: #ebeded;
|
|
|
|
|
float: left;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin-top: 7px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li:before {
|
|
|
|
|
background: #ebeded;
|
|
|
|
|
float: left;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
width: 15px;
|
|
|
|
|
height: 15px;
|
|
|
|
|
margin:2px 10% 0 0;
|
|
|
|
|
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-footer {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
background: #cacaca;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
height: 40px;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
float: left;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: table;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-footer:before {
|
|
|
|
|
width: 60%;
|
|
|
|
|
height: 5px;
|
|
|
|
|
background: #ededed;
|
2015-07-29 12:17:18 +08:00
|
|
|
|
margin: 10px auto 0;
|
2015-07-28 18:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-footer:after {
|
|
|
|
|
width: 30%;
|
|
|
|
|
height: 5px;
|
|
|
|
|
background: #ededed;
|
|
|
|
|
margin: 5px auto;
|
|
|
|
|
}
|
|
|
|
|
.code-box-demo .demo-header ul li:before,
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li:before,
|
|
|
|
|
.code-box-demo .demo-content .demo-kp ul li:after,
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list .title:before,
|
2015-07-29 12:17:18 +08:00
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list .title:after,
|
2015-07-28 18:33:40 +08:00
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list ul li:before,
|
|
|
|
|
.code-box-demo .demo-content .demo-listBox .demo-list ul li:after,
|
|
|
|
|
.code-box-demo .demo-footer:before,
|
|
|
|
|
.code-box-demo .demo-footer:after {
|
|
|
|
|
display: block;
|
|
|
|
|
content: "";
|
|
|
|
|
}
|
|
|
|
|
</style>
|