Created
February 17, 2023 05:30
-
-
Save Cvar1984/4d5a2a99e84d38dd75c442931995aeb3 to your computer and use it in GitHub Desktop.
fibonnaci eclipse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$count = 10; | |
function f(int $n) | |
{ | |
$nPrev = 1; | |
$nCurrent = 1; | |
for ($x = 0; $x < $n - 1; $x++) { | |
$nNext = $nPrev + $nCurrent; | |
$nPrev = $nCurrent; | |
$nCurrent = $nNext; | |
yield $nCurrent; | |
} | |
} | |
$x = 300; | |
$y = 350; | |
$image = imagecreatetruecolor($x, $y); // horizontal, vertical | |
$white = imagecolorallocatealpha($image, 255, 255, 255, 75); | |
$yellow = imagecolorallocatealpha($image, 255, 255, 0, 75); | |
foreach (f($count) as $fbn) { | |
imageellipse($image, (70 + $fbn), (100 + $fbn), (100 + $fbn), (150 + $fbn), $yellow); | |
} | |
header('Content-type: image/png'); | |
ImagePNG($image); | |
ImageDestroy($image); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment