Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created September 23, 2014 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/e00cf5924da15cb3fa42 to your computer and use it in GitHub Desktop.
Save phpfiddle/e00cf5924da15cb3fa42 to your computer and use it in GitHub Desktop.
[ Posted by Vince ] Makes a little circle of divs.
<?php $size = 40; ?>
<style>
.ball{
height:<?php echo $size;?>px; width:<?php echo $size;?>px; background-color:rgba(0,200,0,.025);
position:absolute;
border-radius: 50%;
text-align:center;
line-height:<?php echo $size;?>px;
color:rgba(0,59,0,.1);
font-family:sans-serif;
}
#william{ position:relative;
width:400px;
height:400px;
margin-left:200px;
margin-top:200px}
</style>
<div id="william">
<?php
function divy($x = 0, $y = 0, $word = "panic"){
echo '<div class="ball" style="top:'.$y.'px;right:'.$x.'px">'.$word.'</div>';
}
$c=200;
for ($i = 0; $i <360; $i++){
$x = cos($i)*$c;
$y = sin($i)*$c;
divy($x,$y);
if ($i%2){
divy($x);
divy(0,$y);
}
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment