php-spinner/examples/example.php

32 lines
966 B
PHP

<?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);
$spinner10 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\SpinningBarStyle::class);
$spinner11 = new Spinner(fps:10, style:NoccyLabs\Spinner\Style\BrailleBounceStyle::class);
// And blast them out every 10ms!
while(true) {
echo "\r $spinner1 $spinner2 $spinner3 $spinner4 $spinner5 $spinner6 $spinner7 $spinner8 $spinner9 $spinner10 $spinner11 ";
usleep(10000);
}