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