File: imfade.go

package info (click to toggle)
golang-github-ajstarks-svgo 2012-01-27-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,720 kB
  • sloc: xml: 80; makefile: 31; sh: 29
file content (29 lines) | stat: -rw-r--r-- 518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

import (
	"fmt"
	"os"

	"github.com/ajstarks/svgo"
)

var canvas = svg.New(os.Stdout)

func main() {
	width := 768
	height := 128
	image := "gophercolor128x128.png"
	if len(os.Args) > 1 {
		image = os.Args[1]
	}
	canvas.Start(width, height)
	canvas.Title("Image Fade")
	opacity := 1.0
	for i := 0; i < width-128; i += 100 {
		canvas.Image(i, 0, 128, 128, image, fmt.Sprintf("opacity:%.2f", opacity))
		opacity -= 0.10
	}
	canvas.Grid(0, 0, width, height, 16, "stroke:gray; opacity:0.2")

	canvas.End()
}