Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $canvas = $this->canvas;
- $canvas->size = [300, 300];
- $canvas->position = [0, 0];
- $gc = $canvas->getGraphicsContext();
- $x = $canvas->width / 2;
- $y = $canvas->height / 2;
- $size = 50;
- // точки ограничения рабочей области
- // delete
- $gc->fillRect(10, 10, 10, 10);
- $gc->fillRect($x * 2 - 10, $y * 2 - 10, 10, 10);
- $th = new Thread(function () use ($gc, $x, $y, $size, $canvas) {
- $gc->strokeColor = UXColor::rgb(25, 75, 100);
- for($i = -90; $i < 280; $i++) {
- $rad = deg2rad($i);
- // это чтобы ты понял что тут происходит
- if($i === 0) {
- $gc->strokeColor = UXColor::rgb(200, 0, 0);
- }
- uiLater(function () use ($gc, $rad, $x, $y, $size, $canvas) {
- $gc->beginPath(); // забыл добавить
- $gc->moveTo(cos($rad) + $x, sin($rad) + $y);
- $gc->lineTo(cos($rad) * $size + $x, sin($rad) * $size + $y);
- $gc->stroke();
- $gc->closePath();
- /* $gc->strokeColor = UXColor::rgb(155, 155, 155);
- $gc->moveTo(cos($rad) + $x, sin($rad) + $y);
- $gc->lineTo(cos($rad) * ($size - 25) + $x, sin($rad) * ($size - 25) + $y);
- $gc->stroke(); */
- });
- wait(10);
- }
- });
- $th->start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement