Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Plasma-effect/Sidef/plasma-effect.sidef
Normal file
25
Task/Plasma-effect/Sidef/plasma-effect.sidef
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
require('Imager')
|
||||
|
||||
class Plasma(width=400, height=400) {
|
||||
|
||||
has img = nil
|
||||
|
||||
method init {
|
||||
img = %O|Imager|.new(xsize => width, ysize => height)
|
||||
}
|
||||
|
||||
method generate {
|
||||
for y=(^height), x=(^width) {
|
||||
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]))
|
||||
}
|
||||
}
|
||||
|
||||
method save_as(filename) {
|
||||
img.write(file => filename)
|
||||
}
|
||||
}
|
||||
|
||||
var plasma = Plasma(256, 256)
|
||||
plasma.generate
|
||||
plasma.save_as('plasma.png')
|
||||
Loading…
Add table
Add a link
Reference in a new issue