Code: Select all
// text crawl
package main
import (
"bufio"
"github.com/ajstarks/openvg"
"os"
"time"
)
func main() {
width, height := openvg.Init()
x := openvg.VGfloat(width) * 0.10
h2 := openvg.VGfloat(height / 2)
w := openvg.VGfloat(width)
fs := width/20
s := "These are the times that try men's souls"
openvg.Start(width, height)
openvg.BackgroundColor("black")
for i := 0; i < len(s); i++ {
openvg.FillRGB(44, 100, 232, 1)
openvg.Rect(0, h2/2, w, h2)
openvg.FillColor("white")
openvg.Text(x, h2, s[i:], "serif", fs)
time.Sleep(150*time.Millisecond)
openvg.End()
}
openvg.FillRGB(44, 100, 232, 1)
openvg.Rect(0, h2/2, w, h2)
openvg.End()
bufio.NewReader(os.Stdin).ReadBytes('\n')
openvg.Finish()
}