2020-05-16 18:31:25 +00:00
|
|
|
package patterns
|
|
|
|
|
|
|
|
import "math/rand"
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
func RedPanel(w int, h int) [][]RGBcolor {
|
|
|
|
return FillPanel(w, h, 255, 0, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
var lastColour RGBcolor
|
|
|
|
var lastIteration uint16 = 0
|
2020-05-17 12:25:46 +00:00
|
|
|
var lastPlasmaValue byte = 0
|
2020-05-16 18:31:25 +00:00
|
|
|
|
|
|
|
func RandomColourPanel(w int, h int, speed uint16) [][]RGBcolor {
|
|
|
|
if lastIteration > 0 {
|
|
|
|
lastIteration -= 40
|
|
|
|
}
|
|
|
|
if lastIteration <= 0 {
|
|
|
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
|
var newColour RGBcolor
|
|
|
|
newColour[0] = byte(r.Intn(255))
|
|
|
|
newColour[1] = byte(r.Intn(255))
|
|
|
|
newColour[2] = byte(r.Intn(255))
|
|
|
|
lastColour = newColour
|
|
|
|
lastIteration = speed
|
|
|
|
}
|
|
|
|
return FillPanel(w, h, lastColour[0], lastColour[1], lastColour[2])
|
2020-05-17 12:25:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func PlasmaColourPanel(w int, h int, speed uint16) [][]RGBcolor {
|
|
|
|
if lastIteration > 0 {
|
|
|
|
lastIteration -= 40
|
|
|
|
}
|
|
|
|
if lastIteration <= 0 {
|
|
|
|
lastPlasmaValue++
|
|
|
|
var newColour RGBcolor
|
|
|
|
newColour[0],newColour[1],newColour[2] = plasmaRGBFromVal(lastPlasmaValue)
|
|
|
|
lastColour = newColour
|
|
|
|
lastIteration = speed
|
|
|
|
}
|
|
|
|
return FillPanel(w, h, lastColour[0], lastColour[1], lastColour[2])
|
2020-05-16 18:31:25 +00:00
|
|
|
}
|