-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.go
46 lines (39 loc) · 1.09 KB
/
color.go
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package gop5js
import "fmt"
func Background(color string) {
_, err := sketchDraw.WriteString(
fmt.Sprintf("background(%s);", color),
)
ErrorContainer.add(err)
}
// Clear clears the pixels within a buffer. This function only
// works on p5.Canvas objects created with the createCanvas()
// function; it won't work with the main display window. Unlike
// the main graphics context, pixels in additional graphics areas
// created with createGraphics() can be entirely or partially
// transparent. This function clears everything to make all of
// the pixels 100% transparent.
func Clear() {
_, err := sketchDraw.WriteString("clear();")
ErrorContainer.add(err)
}
func Fill(color string) {
_, err := sketchDraw.WriteString(
fmt.Sprintf("fill(%s);", color),
)
ErrorContainer.add(err)
}
func NoFill() {
_, err := sketchDraw.WriteString("noFill();")
ErrorContainer.add(err)
}
func NoStroke() {
_, err := sketchDraw.WriteString("noStroke();")
ErrorContainer.add(err)
}
func Stroke(color string) {
_, err := sketchDraw.WriteString(
fmt.Sprintf("stroke(%s);", color),
)
ErrorContainer.add(err)
}