Skip to content

Instantly share code, notes, and snippets.

@pierrejoye
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save pierrejoye/00b2f29915a467492c45 to your computer and use it in GitHub Desktop.

Select an option

Save pierrejoye/00b2f29915a467492c45 to your computer and use it in GitHub Desktop.
<?php
$radius = 249;
$im = imagecreatetruecolor(500, 500);
imagefill($im, 0,0, imagecolorallocatealpha($im, 0,0,0,127));
imagealphablending($im, false );
imagesavealpha($im, true);
$color_obj = 0xff0000;
$object_count = 20;
$object_radius = 10;
imagefilledellipse($im, 250,250, $radius, $radius, 0xFFFFFF);
$step_offset = deg2rad(360 / $object_count);
echo "step offset: $step_offset\n";
for ($i = 0; $i < $object_count; $i++) {
$x = 250 + $radius/2 * cos($step_offset * $i);
$y = 250 + $radius/2 * sin($step_offset * $i);
echo "$x $y\n";
imagefilledellipse($im, $x, $y, $object_radius, $object_radius, $object_color);
}
imagepng($im, 'circle.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment