aardio 文档

aardio 范例: 控制台程序 - 加载动画与进度

//控制台程序 - 加载动画与进度
import console;
import console.progress; 
var bar = console.progress();
for(i=1;100; 1){
    bar.setProgress(i,i +"% loading ......");
    sleep(30)
}

console.showLoading("loading",,console.color.yellow);
sleep(1000)
console.log("调用 console.log 等可以自动打开控制台的函数都可以自动关闭console.showLoading 函数创建的动画")

//感谢 nlysh 收集的 dotTable
var dotTable = {
    {"   ";".  ";".. ";"...";"....";"......";interval=200};
    {"╲ ";"│ ";"╱ ";"─ "};
    {"┽ ";"╀ ";"┾ ";"╁ "};
    {"▏";"▎";"▍";"▌";"▋";"▊";"▉"};
    {"▁";"▂";"▃";"▄";"▅";"▆";"▇";"█"};
    {"←";"↖";"↑";"↗";"→";"↘";"↓";"↙"};
    {"◢";"◣";"◤";"◥"};
    {"=    ";" ==  ";" === ";" ====";"  ===";"   ==";"    =";""};
    {"●     ";" ●    ";"  ●   ";"   ●  ";"    ● ";"     ●";"    ● ";"   ●  ";"  ●   ";" ●    "};
    {">))'>    ";" >))'>   ";"  >))'>  ";"   >))'> ";"    >))'>";"    <'((<";"   <'((< ";"  <'((<  ";" <'((<   ";"<'((<    "};
    {"┏ ";"┓ ";"┛ ";"┗ "};
    {"╒ ";"╕ ";"╛ ";"╘ "};
    {"╔ ";"╗ ";"╝ ";"╚ "};
    {"┳ ";"┫ ";"┻ ";"┣ "};
    {"┬ ";"┤ ";"┴ ";"├ "};
    {"╦ ";"╣ ";"╩ ";"╠ "};

    {" ▹▹▹▹";"▹ ▹▹▹";"▹▹ ▹▹";"▹▹▹ ▹";"▹▹▹▹ "};
    {"◴";"◷";"◶";"◵"};
    {"◜";"◠";"◝";"◞";"◡";"◟"};
    {"◇◇◇";"◈◇◇";"◇◈◇";"◇◇◈"};
    {"▖";"▘";"▝";"▗"};
    {"✶";"✸";"✹";"✺";"✹";"✷"};
    {"◰";"◳";"◲";"◱"};
    {"⠋";"⠙";"⠹";"⠸";"⠼";"⠴";"⠦";"⠧";"⠇";"⠏"};
    {"⠋";"⠙";"⠚";"⠞";"⠖";"⠦";"⠴";"⠲";"⠳"};
    {"⋮ ";"⋰ ";"⋯ ";"⋱ "};
    {"☱";"☲";"☴"};
}

console.setLoadingDots(dotTable[1],true);
for(i=1;15;1){
    console.showLoading(i + "% loading "); 
    sleep(50);
}

console.pause(true);

Markdown 格式