Circle #
PhpTui\Tui\Extension\Core\Shape\CircleShape
Draws a circle at with the specified radius and color
Example #
Show code
<?php
declare(strict_types=1);
use PhpTui\Tui\Canvas\Marker;
use PhpTui\Tui\Color\AnsiColor;
use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Shape\CircleShape;
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget;
require 'vendor/autoload.php';
$display = DisplayBuilder::default()->build();
$display->draw(
CanvasWidget::fromIntBounds(-1, 21, -1, 21)
->marker(Marker::Dot)
->draw(CircleShape::fromScalars(10, 10, 10)->color(AnsiColor::Green))
);
Parameters #
Configure the shape using the builder methods named as follows:
Name | Type | Description |
---|---|---|
position | PhpTui\Tui\Position\FloatPosition | Position of the circle |
radius | float | Radius of the circle |
color | PhpTui\Tui\Color\Color | Color of the circle |