diff options
author | Martin Ashby <martin@martin-laptop.lan> | 2018-06-02 09:46:43 +0100 |
---|---|---|
committer | Martin Ashby <martin@martin-laptop.lan> | 2018-06-02 09:46:43 +0100 |
commit | 4a353d95f6d2dd8a9841bdae6f0721f5b014599e (patch) | |
tree | c0f039c5e7711d1163f641117b8f5548ab8d282f /MakeGif.go | |
parent | 76180c302197e83a257b975394768e5affa4054e (diff) | |
parent | 4a9b96e5cc8bf822bf3b2860b175f446cb45f98a (diff) | |
download | unicornpaint-4a353d95f6d2dd8a9841bdae6f0721f5b014599e.tar.gz unicornpaint-4a353d95f6d2dd8a9841bdae6f0721f5b014599e.tar.bz2 unicornpaint-4a353d95f6d2dd8a9841bdae6f0721f5b014599e.tar.xz unicornpaint-4a353d95f6d2dd8a9841bdae6f0721f5b014599e.zip |
Merge branch 'master' of github.com:MFAshby/unicornpaint
Diffstat (limited to 'MakeGif.go')
-rw-r--r-- | MakeGif.go | 38 |
1 files changed, 25 insertions, 13 deletions
@@ -1,3 +1,5 @@ +// +build ignore + package main import ( @@ -8,6 +10,8 @@ import ( "image/draw" "image/gif" "io/ioutil" + "log" + "os" "time" "github.com/MFAshby/unicornpaint/unicorn" @@ -72,8 +76,8 @@ func renderGif(un unicorn.Unicorn, gf *gif.GIF) { } func main() { - b1, _ := ioutil.ReadFile("saves/modern") - b2, _ := ioutil.ReadFile("saves/modern2") + b1, _ := ioutil.ReadFile("saves/rain1") + b2, _ := ioutil.ReadFile("saves/rain2") px1 := [][][]uint8{} json.Unmarshal(b1, &px1) @@ -87,20 +91,28 @@ func main() { Image: []*image.Paletted{im1, im2}, Delay: []int{50, 50}, // 100ths of a second } + // im := image.NewPaletted( + // image.Rect(0, 0, 16, 16), + // palette.WebSafe) - // f1, err := os.Create("saves/modern.gif") - // if err != nil { - // log.Fatalf("Error opening GIF file to write %v", err) - // } - // defer f1.Close() - // err = gif.EncodeAll(f1, gf) - // if err != nil { - // log.Printf("Error writing GIF %v", err) + // gf := &gif.GIF{ + // Image: []*image.Paletted{im}, + // Delay: []int{100}, // } - un, _ = unicorn.NewUnicorn() + f1, err := os.Create("saves/blank.gif") + if err != nil { + log.Fatalf("Error opening GIF file to write %v", err) + } + defer f1.Close() + err = gif.EncodeAll(f1, gf) + if err != nil { + log.Printf("Error writing GIF %v", err) + } + + // un, _ = unicorn.NewUnicorn() - go renderGif(un, gf) + // go renderGif(un, gf) - un.MainLoop() + // un.MainLoop() } |