You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
7.7 KiB

---
category:
zh-CN: 设计基础
en-US: Design Fundamental
order: 5
title:
zh-CN: 组件动画
en-US: Motion
---
依据『巧用过渡』的设计原则,Ant Design 提供了一些预设的组件动画和缓动函数。更多动画可参考 [Ant Motion](https://motion.ant.design/)
9 years ago
> 示例延长了动画时长以便展示。
`````__react
const cssAnimation = require('css-animation');
const antd = require('antd');
const Select = antd.Select;
const Option = Select.Option;
const OptGroup = Select.OptGroup;
let motions = [];
motions = motions.concat([[{
name: '淡入',
value: 'fade',
direction: 'enter',
type: '渐隐'
}, {
name: '淡出',
value: 'fade',
direction: 'leave',
type: '渐隐'
}]]);
motions = motions.concat([[{
name: '中心放大',
value: 'zoom',
direction: 'enter',
type: '缩放'
}, {
name: '中心缩小',
value: 'zoom',
direction: 'leave',
type: '缩放'
}, {
name: '上方放大',
value: 'zoom-up',
direction: 'enter',
type: '缩放'
}, {
name: '上方缩小',
value: 'zoom-up',
direction: 'leave',
type: '缩放'
}, {
name: '下方放大',
value: 'zoom-down',
direction: 'enter',
type: '缩放'
}, {
name: '下方缩小',
value: 'zoom-down',
direction: 'leave',
type: '缩放'
}, {
name: '左方放大',
value: 'zoom-left',
direction: 'enter',
type: '缩放'
}, {
name: '左方缩小',
value: 'zoom-left',
direction: 'leave',
type: '缩放'
}, {
name: '右方放大',
value: 'zoom-right',
direction: 'enter',
type: '缩放'
}, {
name: '右方缩小',
value: 'zoom-right',
direction: 'leave',
type: '缩放'
}]]);
motions = motions.concat([[{
name: '上方滑入',
value: 'move-up',
direction: 'enter',
type: '移动'
}, {
name: '上方滑出',
value: 'move-up',
direction: 'leave',
type: '移动'
}, {
name: '下方滑入',
value: 'move-down',
direction: 'enter',
type: '移动'
}, {
name: '下方滑出',
value: 'move-down',
direction: 'leave',
type: '移动'
}, {
name: '左方滑入',
value: 'move-left',
direction: 'enter',
type: '移动'
}, {
name: '左方滑出',
value: 'move-left',
direction: 'leave',
type: '移动'
}, {
name: '右方滑入',
value: 'move-right',
direction: 'enter',
type: '移动'
}, {
9 years ago
name: '右方滑出',
value: 'move-right',
direction: 'leave',
type: '移动'
}]]);
motions = motions.concat([[{
name: '上方展开',
value: 'slide-up',
direction: 'enter',
type: '伸缩'
}, {
name: '上方缩回',
value: 'slide-up',
direction: 'leave',
type: '伸缩'
}, {
name: '下方展开',
value: 'slide-down',
direction: 'enter',
type: '伸缩'
}, {
name: '下方缩回',
value: 'slide-down',
direction: 'leave',
type: '伸缩'
}, {
name: '左方展开',
value: 'slide-left',
direction: 'enter',
type: '伸缩'
}, {
name: '左方缩回',
value: 'slide-left',
direction: 'leave',
type: '伸缩'
}, {
name: '右方展开',
value: 'slide-right',
direction: 'enter',
type: '伸缩'
}, {
name: '右方缩回',
value: 'slide-right',
direction: 'leave',
type: '伸缩'
}]]);
motions = motions.concat([[{
name: '摇摆',
value: 'swing',
direction: 'enter',
type: '其他'
}]]);
9 years ago
var leave = '-leave';
var Test = React.createClass({
handleChange(e) {
var value = e;
9 years ago
if (value) {
this.demoNode.style.visibility = '';