Julia set: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: more simplification, DRY) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: remove a bunch of superstitious parenthesis) |
||
Line 121:
<lang perl6>use Image::PNG::Portable;
my ($w, $h) =
my $out = Image::PNG::Portable.new: :width($w), :height($h);
Line 127:
my $maxIter = 255;
my ($cX, $cY) =
julia($out);
Line 140:
my $i = $maxIter;
while $zx² + $zy² < 4 and --$i {
($zy, $zx) =
}
$png.set
}
}
Line 152:
my $m = $v - $c;
my ($r, $g, $b) = do given $h {
when 0..^60 {
when 60..^120 {
when 120..^180 {
when 180..^240 {
when 240..^300 {
when 300..^360 {
}
( $r, $g, $b ) = map { (($_+$m) * 255).Int }, $r, $g, $b;
|