Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?
Moderator: General Moderators
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Mon Jan 24, 2005 1:48 pm
I'm on a roll here. Playing with imagepolygon() stuff, I came up with a nice function to make stars..
Code: Select all
function star($number_of_points,$outer_radius=100,$inner_radius=40) {
$p = array();
$degrees = 360/($number_of_points*2);
for ($i=0;$i<$number_of_points*2;$i++) {
$cos = cos(deg2rad($degrees*$i));
$sin = sin(deg2rad($degrees*$i));
$x = 0;
$y = ($i%2==0)?$outer_radius:$inner_radius;
$pї] = $cos*($x) - $sin*($y);
$pї] = $sin*($x) + $cos*($y);
}
return $p;
}
Small isue with it at the moment coz it doesn't work with the rotatePolygon() function I posted yesterday. I'll fix it eventually. Unless someone else does.
Made a groovy pic using this function:
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Tue Feb 08, 2005 7:53 am
Wow that is pretty cool. I couldn't work it until I looked closer and saw that the whole picture is made from stars.
I like cool code like that... I hated maths at school but now with programming I see why we learnt it and how it can actually be pretty fun...
Nice one
windwaker
Forum Newbie
Posts: 21 Joined: Sun Feb 13, 2005 11:18 am
Post
by windwaker » Sun Feb 13, 2005 8:01 pm
Whoa, that's awesome, though I can imagine that'll take up some CPU time. @_@