UNPKG

clay-core

Version:

Provide a more friendly web-side drawing interface!

53 lines (49 loc) 1.6 kB
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="../../libs/easycss-1.3.1.min.css"> <link rel="stylesheet" href="../../libs/prettify.css"> <link rel="stylesheet" href="../../doc.css"> <script src="../../libs/prettify.js"></script> </head> <body onload="prettyPrint()"> <header> 轮询 </header> <h2> loop </h2> <h4> 普通的轮询 </h4> <pre class='prettyprint lang-js'>$$.loop(datas, function(value, key, index){ // 在这里添加处理方法 });</pre> <p> datas是一个可迭代的数组或json等即可,第二个参数是一个函数,其中value、key和index分别是当前面对的数据值,数据名和索引。 </p> <h4> 数据绑定轮询 </h4> <pre class='prettyprint lang-js'>clayObject.loop(function(data, index, target){ // 在这里添加处理方法 });</pre> <p> 其中data表示结点绑定的数据,index表示结点序号,target表示当前结点。 </p> <h2> animation </h2> <pre class='prettyprint lang-js'>$$.animaion(function(deep){ // 这里编写轮询方法,deep[0-1],表示动画进度 },duration,function(){ // 动画结束回调 });</pre> <p> 一个状态过渡到另外一个状态,比如位置的缓慢移动,可以调用animation方法,其中duration控制动画时长。 </p> </body> </html>