Skip to content

Commit

Permalink
entangler "finished"
Browse files Browse the repository at this point in the history
  • Loading branch information
mangofeet committed May 10, 2024
1 parent 4f7bff1 commit 0ca1b3f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 39 deletions.
39 changes: 23 additions & 16 deletions art/entangler/draw.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (drawer Entangler) Draw(ctx *canvas.Context, card *nrdb.Printing) error {
nGrid = float64(numWalkers) * *drawer.GridPercent
}

dirChangeStep := 38.0
dirChangeStep := 60.0
// dirChangeStep := float64(rngGlobal.Next(15) + 40)

// do manual seeds for these with high numbers so they didn't
Expand Down Expand Up @@ -249,6 +249,7 @@ func (drawer Entangler) Draw(ctx *canvas.Context, card *nrdb.Printing) error {
direction = "right"
// thisStartX -= int64(ringRadiusStart)
}

switch direction {
case altColorDirection1:
thisColor = walkerColor1
Expand All @@ -259,19 +260,32 @@ func (drawer Entangler) Draw(ctx *canvas.Context, card *nrdb.Printing) error {
case altColorDirection4:
thisColor = walkerColor4
}

switch rngGlobal.Next(8) {
case 1:
thisColor = walkerColor1
case 2:
thisColor = walkerColor2
case 3:
thisColor = walkerColor3
case 4:
thisColor = walkerColor4
}

}

sequence = int64(i)

wlk := art.Walker{
RNG: prng.NewGenerator(seed, &sequence),
Direction: direction,
DirectionVariance: 2,
DirectionChangeStep: dirChangeStep,
X: float64(thisStartX),
Y: float64(thisStartY),
Vx: (float64(rngGlobal.Next(100)) / 100) - 0.5,
Vy: (float64(rngGlobal.Next(100)) / 100) - 0.5,
RNG: prng.NewGenerator(seed, &sequence),
Direction: direction,
DirectionVariance: 1,
DirectionChangeStep: dirChangeStep,
DirectionChangeStepModifier: 1,
X: float64(thisStartX),
Y: float64(thisStartY),
Vx: (float64(rngGlobal.Next(100)) / 100) - 0.5,
Vy: (float64(rngGlobal.Next(100)) / 100) - 0.5,
Color: color.RGBA{
R: uint8(math.Max(0, math.Min(float64(int64(thisColor.R)+colorFactor), 255))),
G: uint8(math.Max(0, math.Min(float64(int64(thisColor.G)+colorFactor), 255))),
Expand Down Expand Up @@ -319,13 +333,6 @@ func (drawer Entangler) Draw(ctx *canvas.Context, card *nrdb.Printing) error {
OverlayColor: &canvas.Transparent,
}).Draw(ctx, card)
for _, wlk := range walkers {

// if i == (len(walkers) / 4) {
// }

// if i == (len(walkers)/8)*7 {
// }

wlk.Draw(ctx)
for wlk.InBounds(ctx) {
wlk.Velocity()
Expand Down
42 changes: 19 additions & 23 deletions art/walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ type point struct {
}

type Walker struct {
RNG prng.Generator
Direction string
DirectionVariance int64
X, Y, Vx, Vy float64
Color color.Color
Noise opensimplex.Noise
Grid bool
StrokeWidth float64
stepCount int
DirectionChangeStep float64
prev *point
RNG prng.Generator
Direction string
DirectionVariance int64
X, Y, Vx, Vy float64
Color color.Color
Noise opensimplex.Noise
Grid bool
StrokeWidth float64
stepCount int
DirectionChangeStep float64
DirectionChangeStepModifier float64
prev *point
}

func (wlk Walker) String() string {
Expand Down Expand Up @@ -122,23 +123,18 @@ func (wlk *Walker) maybeChangeDirection() {
if wlk.DirectionChangeStep == 0 {
wlk.DirectionChangeStep = 30
}
if wlk.DirectionChangeStepModifier == 0 {
wlk.DirectionChangeStepModifier = 3
}

if wlk.stepCount%int(wlk.DirectionChangeStep) != 0 {
return
}

wlk.DirectionChangeStep *= 3

// switch wlk.Direction {
// case "up":
// wlk.Direction = "right"
// case "right":
// wlk.Direction = "down"
// case "down":
// wlk.Direction = "left"
// case "left":
// wlk.Direction = "up"
// }
wlk.DirectionChangeStep *= wlk.DirectionChangeStepModifier
if wlk.DirectionChangeStep < 1 {
wlk.DirectionChangeStep = 1
}

if wlk.DirectionVariance > 4 {
wlk.DirectionVariance = 4
Expand Down

0 comments on commit 0ca1b3f

Please sign in to comment.