2 Commits

Author SHA1 Message Date
8a0c9ccffc Added width to StyleInterface 2024-03-07 01:06:40 +01:00
51f7259fe9 Added wide braille spinner style 2022-10-05 20:59:13 +02:00
10 changed files with 99 additions and 3 deletions

View File

@ -27,9 +27,11 @@ $spinner12 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleTallDotsSt
$spinner13 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleWideDotsStyle::class); $spinner13 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleWideDotsStyle::class);
$spinner14 = new Spinner(fps:20, style:NoccyLabs\Spinner\Style\BrailleWideSpinnerStyle::class);
// And blast them out every 10ms! // And blast them out every 10ms!
while(true) { while(true) {
echo "\r $spinner1 $spinner2 $spinner3 $spinner4 $spinner5 $spinner6 $spinner7 $spinner8 $spinner9 $spinner10 $spinner11 $spinner12 $spinner13 "; echo "\r $spinner1 $spinner2 $spinner3 $spinner4 $spinner5 $spinner6 $spinner7 $spinner8 $spinner9 $spinner10 $spinner11 $spinner12 $spinner13 $spinner14";
usleep(10000); usleep(10000);
} }

View File

@ -15,4 +15,9 @@ class BrailleBounceStyle implements StyleInterface
mb_chr(0x2812), mb_chr(0x2812),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -15,4 +15,9 @@ class BrailleDotsStyle implements StyleInterface
mb_chr(0x281b), mb_chr(0x281b),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -17,6 +17,11 @@ class BrailleTallDotsStyle implements StyleInterface
mb_chr(0x281b), mb_chr(0x281b),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }
/* /*
@ -39,4 +44,4 @@ class BrailleTallDotsStyle implements StyleInterface
28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿ 28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿
*/ */

View File

@ -21,6 +21,11 @@ class BrailleWideDotsStyle implements StyleInterface
"⠈⠙", "⠈⠙",
]; ];
} }
public function getWidth(): int
{
return 2;
}
} }
/* /*
@ -43,4 +48,4 @@ class BrailleWideDotsStyle implements StyleInterface
28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿ 28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿
*/ */

View File

@ -0,0 +1,51 @@
<?php
namespace NoccyLabs\Spinner\Style;
class BrailleWideSpinnerStyle implements StyleInterface
{
public function getFrames(): array
{
return [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
];
}
public function getWidth(): int
{
return 2;
}
}
/*
| xxx0 xxx1 xxx2 xxx3 xxx4 xxx5 xxx6 xxx7 xxx8 xxx9 xxxA xxxB xxxC xxxD xxxE xxxF
280x | ⠁ ⠂ ⠃ ⠄ ⠅ ⠆ ⠇ ⠈ ⠉ ⠊ ⠋ ⠌ ⠍ ⠎ ⠏
281x | ⠐ ⠑ ⠒ ⠓ ⠔ ⠕ ⠖ ⠗ ⠘ ⠙ ⠚ ⠛ ⠜ ⠝ ⠞ ⠟
282x | ⠠ ⠡ ⠢ ⠣ ⠤ ⠥ ⠦ ⠧ ⠨ ⠩ ⠪ ⠫ ⠬ ⠭ ⠮ ⠯
283x | ⠰ ⠱ ⠲ ⠳ ⠴ ⠵ ⠶ ⠷ ⠸ ⠹ ⠺ ⠻ ⠼ ⠽ ⠾ ⠿
284x | ⡀ ⡁ ⡂ ⡃ ⡄ ⡅ ⡆ ⡇ ⡈ ⡉ ⡊ ⡋ ⡌ ⡍ ⡎ ⡏
285x | ⡐ ⡑ ⡒ ⡓ ⡔ ⡕ ⡖ ⡗ ⡘ ⡙ ⡚ ⡛ ⡜ ⡝ ⡞ ⡟
286x | ⡠ ⡡ ⡢ ⡣ ⡤ ⡥ ⡦ ⡧ ⡨ ⡩ ⡪ ⡫ ⡬ ⡭ ⡮ ⡯
287x | ⡰ ⡱ ⡲ ⡳ ⡴ ⡵ ⡶ ⡷ ⡸ ⡹ ⡺ ⡻ ⡼ ⡽ ⡾ ⡿
288x | ⢀ ⢁ ⢂ ⢃ ⢄ ⢅ ⢆ ⢇ ⢈ ⢉ ⢊ ⢋ ⢌ ⢍ ⢎ ⢏
289x | ⢐ ⢑ ⢒ ⢓ ⢔ ⢕ ⢖ ⢗ ⢘ ⢙ ⢚ ⢛ ⢜ ⢝ ⢞ ⢟
28Ax | ⢠ ⢡ ⢢ ⢣ ⢤ ⢥ ⢦ ⢧ ⢨ ⢩ ⢪ ⢫ ⢬ ⢭ ⢮ ⢯
28Bx | ⢰ ⢱ ⢲ ⢳ ⢴ ⢵ ⢶ ⢷ ⢸ ⢹ ⢺ ⢻ ⢼ ⢽ ⢾ ⢿
28Cx | ⣀ ⣁ ⣂ ⣃ ⣄ ⣅ ⣆ ⣇ ⣈ ⣉ ⣊ ⣋ ⣌ ⣍ ⣎ ⣏
28Dx | ⣐ ⣑ ⣒ ⣓ ⣔ ⣕ ⣖ ⣗ ⣘ ⣙ ⣚ ⣛ ⣜ ⣝ ⣞ ⣟
28Ex | ⣠ ⣡ ⣢ ⣣ ⣤ ⣥ ⣦ ⣧ ⣨ ⣩ ⣪ ⣫ ⣬ ⣭ ⣮ ⣯
28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿
*/

View File

@ -13,4 +13,9 @@ class RollingBallStyle implements StyleInterface
mb_chr(0x25d2), mb_chr(0x25d2),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -13,4 +13,9 @@ class SpinnerStyle implements StyleInterface
mb_chr(0x25df).' ', mb_chr(0x25df).' ',
]; ];
} }
public function getWidth(): int
{
return 2;
}
} }

View File

@ -13,4 +13,9 @@ class SpinningBarStyle implements StyleInterface
"|", "|",
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -4,5 +4,13 @@ namespace NoccyLabs\Spinner\Style;
interface StyleInterface interface StyleInterface
{ {
/**
* Returns an array of frames used to render the spinner
*/
public function getFrames(): array; public function getFrames(): array;
/**
* Get the width of this spinner in characters
*/
public function getWidth(): int;
} }