Polyspiral: Difference between revisions
→{{header|Go}}: Added code to create GIF file directly from program.
m (Moved Go entry into correct alphabetical order.) |
(→{{header|Go}}: Added code to create GIF file directly from program.) |
||
Line 666:
=={{header|Go}}==
This uses Go's 'image' packages in its standard library to create an animated GIF.
When played this is similar to the Java entry but much quicker. The whole animation completes in 72 seconds and repeats indefinitely.
Line 684 ⟶ 681:
"image/color"
"image/gif"
"log"
"math"
"os"
Line 781 ⟶ 779:
anim.Image = append(anim.Image, img)
}
file, err := os.Create("polyspiral.gif")
gif.EncodeAll(os.Stdout, &anim)▼
if err != nil {
log.Fatal(err)
}
defer file.Close()
log.Fatal(err2)
}
}</lang>
|