Vibrating rectangles: Difference between revisions
→{{header|Go}}: Added code to create GIF file directly from the program.
(Added Go) |
(→{{header|Go}}: Added code to create GIF file directly from the program.) |
||
Line 45:
=={{header|Go}}==
This uses Go's 'image' packages in its standard library to create an animated GIF.
When played this is somewhat similar to the Python entry except that it uses a 7 (rather than 6) color palette and repeats indefinitely.
Line 63 ⟶ 60:
"image/color"
"image/gif"
"log"
"os"
)
Line 131 ⟶ 129:
}
}
file, err := os.Create("vibrating.gif")
gif.EncodeAll(os.Stdout, &anim)▼
if err != nil {
log.Fatal(err)
}
defer file.Close()
log.Fatal(err2)
}
}</lang>
|