commit 5afaaf0432d4c9b6c2d840492eff184af41c961e
parent 28f0ac19eb3b42601b0511131b5e39c77b80da9c
Author: Martin Ashby <martin@martin-laptop.lan>
Date: Mon, 28 May 2018 16:58:04 +0100
TestGif.go tests showing a simple animated
GIF using new Unicorn2 interface
Diffstat:
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/TestGif.go b/TestGif.go
@@ -0,0 +1,33 @@
+// +build ignore
+
+package main
+
+import (
+ "bytes"
+ "image/gif"
+ "log"
+
+ "github.com/MFAshby/unicornpaint/unicorn"
+)
+
+func main() {
+ un, err := unicorn.NewUnicorn2()
+ if err != nil {
+ log.Fatalf("Error getting a unicorn :( %v", err)
+ }
+
+ data, err := unicorn.Asset("data/sample2.gif")
+ if err != nil {
+ log.Fatalf("Error getting rain %v", err)
+ }
+
+ g, err := gif.DecodeAll(bytes.NewReader(data))
+ if err != nil {
+ log.Fatalf("Error decoding gif %v", err)
+ }
+
+ un.SetGif(g)
+ stopChan := un.StartRender()
+ un.MainLoop()
+ stopChan <- true
+}