php-spinner/examples/example.php

32 lines
966 B
PHP
Raw 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
// And blast them out every 10ms!
while(true) {
2022-10-03 23:46:12 +00:00
echo "\r $spinner1 $spinner2 $spinner3 $spinner4 $spinner5 $spinner6 $spinner7 $spinner8 $spinner9 $spinner10 $spinner11 ";
2022-09-21 23:49:58 +00:00
usleep(10000);
}