php-spinner/examples/example.php

38 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2022-09-21 23:49:58 +00:00
<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Spinner\Spinner;
// Create three spinners with various refresh rates...
$spinner1 = new Spinner(fps:5);
$spinner2 = new Spinner(fps:10);
$spinner3 = new Spinner(fps:20);
Spinner::setDefaultStyle(NoccyLabs\Spinner\Style\RollingBallStyle::class);
$spinner4 = new Spinner(fps:5);
$spinner5 = new Spinner(fps:10);
$spinner6 = new Spinner(fps:20);
Spinner::setDefaultStyle(NoccyLabs\Spinner\Style\SpinnerStyle::class);
$spinner7 = new Spinner(fps:5);
$spinner8 = new Spinner(fps:10);
$spinner9 = new Spinner(fps:20);
2022-10-03 23:46:12 +00:00
$spinner10 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\SpinningBarStyle::class);
$spinner11 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleBounceStyle::class);
2022-09-21 23:49:58 +00:00
2022-10-05 00:13:59 +00:00
$spinner12 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleTallDotsStyle::class);
2022-10-05 12:33:06 +00:00
$spinner13 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleWideDotsStyle::class);
2022-10-05 18:59:13 +00:00
$spinner14 = new Spinner(fps:20, style:NoccyLabs\Spinner\Style\BrailleWideSpinnerStyle::class);
2022-09-21 23:49:58 +00:00
// And blast them out every 10ms!
while(true) {
2022-10-05 18:59:13 +00:00
echo "\r $spinner1 $spinner2 $spinner3 $spinner4 $spinner5 $spinner6 $spinner7 $spinner8 $spinner9 $spinner10 $spinner11 $spinner12 $spinner13 $spinner14";
2022-09-21 23:49:58 +00:00
usleep(10000);
}