Files
ant-design/spec/motion.html
T
2015-07-30 18:51:44 +08:00

629 lines
15 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="description" content="一个设计语言&前端框架"/>
<title>
组件动画 - Ant Design
</title>
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="shortcut icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="stylesheet" href="/dist/antd-0.8.0-beta1.css">
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/tomorrow.css">
<script>
(function (con) {
'use strict';
var prop, method;
var empty = {};
var dummy = function () {
};
var properties = 'memory'.split(',');
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' +
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' +
'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',');
while (prop = properties.pop()) {
con[prop] = con[prop] || empty;
}
while (method = methods.pop()) {
con[method] = con[method] || dummy;
}
})(this.console = this.console || {});
</script>
<script src="https://a.alipayobjects.com/??bluebird/2.9.30/bluebird.js,jquery/jquery/1.11.1/jquery.js,es5-shim/4.0.5/es5-shim-debug.js,es5-shim/4.0.5/es5-sham-debug.js,html5shiv/3.7.2/src/html5shiv.js,react/0.13.3/react.js,react-router/0.13.3/ReactRouter.js"></script>
<script>
var ANT_COMPONENTS = [];
ANT_COMPONENTS.push({
title: 'Button',
desc: '按钮'
});
ANT_COMPONENTS.push({
title: 'Iconfont',
desc: '字体图标'
});
ANT_COMPONENTS.push({
title: 'Layout',
desc: '布局'
});
ANT_COMPONENTS.push({
title: 'Checkbox',
desc: '多选框'
});
ANT_COMPONENTS.push({
title: 'Radio',
desc: '单选框'
});
ANT_COMPONENTS.push({
title: 'Form',
desc: '表单'
});
ANT_COMPONENTS.push({
title: 'Switch',
desc: '开关'
});
ANT_COMPONENTS.push({
title: 'InputNumber',
desc: '数字输入框'
});
ANT_COMPONENTS.push({
title: 'Slider',
desc: '滑动输入条'
});
ANT_COMPONENTS.push({
title: 'Datepicker',
desc: '日期选择框'
});
ANT_COMPONENTS.push({
title: 'Select',
desc: '选择器'
});
ANT_COMPONENTS.push({
title: 'Tabs',
desc: '标签页'
});
ANT_COMPONENTS.push({
title: 'Steps',
desc: '步骤条'
});
ANT_COMPONENTS.push({
title: 'Breadcrumb',
desc: '面包屑'
});
ANT_COMPONENTS.push({
title: 'Collapse',
desc: '折叠面板'
});
ANT_COMPONENTS.push({
title: 'Affix',
desc: '固定'
});
ANT_COMPONENTS.push({
title: 'Alert',
desc: '警告提示'
});
ANT_COMPONENTS.push({
title: 'Notification',
desc: '系统通知框'
});
ANT_COMPONENTS.push({
title: 'Pagination',
desc: '分页'
});
ANT_COMPONENTS.push({
title: 'Upload',
desc: '文件上传'
});
ANT_COMPONENTS.push({
title: 'Tree',
desc: '树形控件'
});
ANT_COMPONENTS.push({
title: 'Tag',
desc: '标签'
});
ANT_COMPONENTS.push({
title: 'Menu',
desc: '导航菜单'
});
ANT_COMPONENTS.push({
title: 'Carousel',
desc: '走马灯'
});
ANT_COMPONENTS.push({
title: 'EnterAnimation',
desc: '进场动画'
});
ANT_COMPONENTS.push({
title: 'Modal',
desc: '对话框'
});
ANT_COMPONENTS.push({
title: 'Message',
desc: '全局提示'
});
ANT_COMPONENTS.push({
title: 'Dropdown',
desc: '下拉菜单'
});
ANT_COMPONENTS.push({
title: 'Popover',
desc: '气泡卡片'
});
ANT_COMPONENTS.push({
title: 'Popconfirm',
desc: '气泡确认框'
});
ANT_COMPONENTS.push({
title: 'Tooltip',
desc: '文字提示'
});
ANT_COMPONENTS.push({
title: 'Progress',
desc: '进度条'
});
ANT_COMPONENTS.push({
title: 'Table',
desc: '表格'
});
</script>
<script src="/static/script.js"></script>
<script>
window.antdVersion = {
latest: '0.8.0-beta1',
stable: '0.7.3'
};
</script>
<script src="/dist/antd-0.8.0-beta1.js"></script>
<script src="/dist/demo.js"></script>
<script>
window.require = function (path) {
var result = window;
var namespaces = path.split('/');
namespaces.forEach(function (key, i) {
if (i !== 0 && i === namespaces.length - 1) {
key = capitalizeFirstLetter(key);
}
if (key !== 'lib') {
if (result[key]) {
result = result[key];
} else {
throw 'There should not have modules here 2.';
}
}
});
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
return result;
};
</script>
</head>
<body >
<header id="header" class="clearfix">
<a class="logo" href="/">
<img width="60" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg">
Ant Design
</a>
<div class="search">
<div id="autoComplete"></div>
</div>
<nav class="nav">
<span class="bar"></span>
<ul>
<li class="">
<a href="/">首页</a>
</li>
<li class="">
<a href="/docs/introduce">使用</a>
</li>
<li class="current">
<a href="/spec/font">设计</a>
</li>
<li class="">
<a href="/components">组件</a>
</li>
<li>
<a target="_blank" href="https://github.com/ant-design/ant-design">Github</a>
</li>
</ul>
</nav>
</header>
<div class="main-wrapper">
<aside class="aside-container">
<ul>
<li>
<h4>文字</h4>
<ul class="">
<li class="">
<a href="font">
字体
<span class="chinese"></span>
</a>
</li>
<li class="">
<a href="typography">
排版
<span class="chinese"></span>
</a>
</li>
</ul>
</li>
<li>
<h4>色彩</h4>
<ul class="">
<li class="">
<a href="color">
色系和交互
<span class="chinese"></span>
</a>
</li>
</ul>
</li>
<li>
<h4>动画</h4>
<ul class="aside-list-show">
<li class="current">
<a href="motion">
组件动画
<span class="chinese"></span>
</a>
</li>
<li class="">
<a href="easing">
缓动函数
<span class="chinese"></span>
</a>
</li>
<li class="">
<a href="page-transition">
转场动画
<span class="chinese"></span>
</a>
</li>
</ul>
</li>
</ul>
</aside>
<section class="main-container">
<article class="markdown">
<h1>组件动画 </h1>
<p>Ant Design 提供了一些预设的组件动画样式。</p>
<div id="components-motion-demo-basic"></div>
<h2 id="组件动画">组件动画</h2><p>通过设置组件的 <code>transitionName</code> 指定组件动画。</p>
<table>
<thead>
<tr>
<th>组件</th>
<th>中文名</th>
<th>采用动画</th>
</tr>
</thead>
<tbody>
<tr>
<td>popover</td>
<td>气泡浮出层</td>
<td><code>zoom-up</code> <code>zoom-down</code> <code>zoom-left</code> <code>zoom-right</code></td>
</tr>
<tr>
<td>popconfirm</td>
<td>气泡确认框</td>
<td><code>zoom-up</code> <code>zoom-down</code> <code>zoom-left</code> <code>zoom-right</code></td>
</tr>
<tr>
<td>tooltip</td>
<td>文字提示框</td>
<td><code>zoom-up</code> <code>zoom-down</code> <code>zoom-left</code> <code>zoom-right</code></td>
</tr>
<tr>
<td>modal</td>
<td>弹出框</td>
<td><code>zoom</code></td>
</tr>
<tr>
<td>confirm</td>
<td>弹出确认框</td>
<td><code>zoom</code></td>
</tr>
<tr>
<td>message</td>
<td>信息提示条</td>
<td><code>move-up</code></td>
</tr>
<tr>
<td>dropdown</td>
<td>下拉菜单</td>
<td><code>slide-up</code></td>
</tr>
<tr>
<td>select</td>
<td>选择框</td>
<td><code>slide-up</code></td>
</tr>
<tr>
<td>datepicker</td>
<td>日期选择框</td>
<td><code>slide-up</code></td>
</tr>
</tbody>
</table>
<script>(function(){'use strict';
var cssAnimation = require('css-animation');
var 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: '移动'
}, {
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: '其他'
}]]);
var leave = '-leave';
var Test = React.createClass({
displayName: 'Test',
handleChange: function handleChange(e) {
var _this = this;
var value = e.target.value;
if (value) {
this.demoNode.style.visibility = '';
cssAnimation(this.demoNode, value, function () {
if (value.slice(-leave.length) === leave) {
_this.demoNode.style.visibility = 'hidden';
}
});
}
},
componentDidMount: function componentDidMount() {
this.demoNode = React.findDOMNode(this.refs.demo);
},
render: function render() {
var options = [React.createElement(
'option',
{ value: "" },
'请选择预设动画'
)].concat(motions.map(function (m) {
var opts = m.map(function (m2) {
return React.createElement(
'option',
{ value: m2.value + "-" + m2.direction },
m2.name + " " + m2.value
);
});
return React.createElement(
'optgroup',
{ label: m[0].type },
opts
);
}));
return React.createElement(
'div',
null,
React.createElement(
'div',
{ className: "motion-container" },
React.createElement(
'div',
{ ref: "demo", className: "motion-example" },
'栗子'
)
),
React.createElement(
'div',
{ className: "motion-select" },
React.createElement(
'select',
{ onChange: this.handleChange },
options
)
)
);
}
});
React.render(React.createElement(Test, null), document.getElementById('components-motion-demo-basic'));})()</script><style>
.motion-container {
height: 150px;
line-height: 150px;
text-align: center;
margin-bottom: 20px;
}
.motion-example {
background: #4AAFDE;
width: 140px;
height: 140px;
line-height: 140px;
font-size: 18px;
color: #fff;
text-align: center;
display: inline-block !important;
border-radius: 8px;
font-weight: bold;
}
.motion-select {
text-align: center;
}
</style>
</article>
</section>
</div><footer id="footer">
<ul>
<li>
<h2>GitHub</h2>
<a target="_blank "href="https://github.com/ant-design/ant-design">仓库</a>
<a target="_blank" href="https://github.com/ant-design/ant-design/tree/master/style">样式</a>
<a target="_blank" href="https://github.com/ant-design/antd-bin">开发工具</a>
</li>
<li>
<h2>关于我们</h2>
<a href="http://www.atatech.org/teams/79">博客 - Ant UED</a>
</li>
<li>
<h2>联系我们</h2>
<a target="_blank" href="https://github.com/ant-design/ant-design/issues">问题与建议 - Issues</a>
</li>
<li>
<h3>©2015 蚂蚁金服体验技术部出品</h3>
</li>
</ul>
</footer>
</body>
</html>