Plasma effect: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: added link to output file) |
|||
Line 1,314: | Line 1,314: | ||
method init { |
method init { |
||
img = % |
img = %O|Imager|.new(xsize => width, ysize => height) |
||
} |
} |
||
method generate { |
method generate { |
||
for y |
for y=(^height), x=(^width) { |
||
var hue = (4 + sin(x/19) + sin(y/9) + sin((x+y)/25) + sin(hypot(x, y)/8)) |
var hue = (4 + sin(x/19) + sin(y/9) + sin((x+y)/25) + sin(hypot(x, y)/8)) |
||
img.setpixel(x => x, y => y, color => Hash(hsv => [360 * hue / 8, 1, 1])) |
img.setpixel(x => x, y => y, color => Hash(hsv => [360 * hue / 8, 1, 1])) |
||
Line 1,332: | Line 1,332: | ||
plasma.generate |
plasma.generate |
||
plasma.save_as('plasma.png')</lang> |
plasma.save_as('plasma.png')</lang> |
||
Output image: [https://github.com/trizen/rc/blob/master/img/plasma-effect-sidef.png Plasma effect] |