diff --git a/generate_animation.sh b/generate_animation.sh index d30b8c6..81a61f3 100755 --- a/generate_animation.sh +++ b/generate_animation.sh @@ -8,4 +8,4 @@ rm out/step00000.pnm # convert all to PNG parallel --jobs 8 "pnmtopng {} > {.}.png" ::: out/*.pnm # generate video -ffmpeg -y -framerate 30 -pattern_type glob -i 'out/*.png' -r 30 -vf scale=500:-1 -loop 0 out.mp4 +ffmpeg -y -framerate 30 -pattern_type glob -i 'out/*.png' -r 30 -vf scale=500:-1 out.mp4 diff --git a/grayscott.bqn b/grayscott.bqn index 2d37624..24b2a71 100644 --- a/grayscott.bqn +++ b/grayscott.bqn @@ -4,7 +4,7 @@ # Parameters dt‿da‿db‿f‿k←⟨1.0,0.16,0.08,0.060,0.062⟩ n←500 # image size -m←10 # seed size at the center of the image +m←150 # seed size at the center of the image # Discrete Laplacian Lapl←(+´∘∾1‿¯1(⌽⋈⌽˘)¨<)-4⊸× @@ -15,15 +15,16 @@ Update←(UpdateA⋈UpdateB)´ # Initialization a←n‿n⥊1 -Mask←{𝕩‿𝕩↑(-𝕨‿𝕨+𝕩÷2)↑(2×𝕨‿𝕨)⥊1} -b←(m Mask n)⌈0.1×n‿n•rand.Range 0 +SquareMask←{𝕩‿𝕩↑(-𝕨‿𝕨+𝕩÷2)↑(2×𝕨‿𝕨)⥊1} +CircleMask←{(𝕨×𝕨)≥(⌽∘⍉∾⍉)(⌽∾⊢)+○(⋆⟜2)⌜˜↕𝕩÷2} +mask←(n‿n•rand.Range 2)×m CircleMask n +b←mask⌈0.05×n‿n•rand.Range 0 # Run Step←{stepsize 𝕊 i‿a‿b: - •term.OutRaw"." - •term.Flush @ + •Show i×stepsize ap‿bp←Update⍟stepsize a‿b - ("out/step"∾(¯5↑∾•Fmt¨5-⊸↑i)∾".pnm")•file.Chars (PPM ⌊255×>Inferno¨1-a)∾@+10 + ("out/step"∾(¯5↑∾•Fmt¨5-⊸↑i)∾".pnm")•file.Chars (PPM ⌊255×>Viridis¨1-a)∾@+10 (i+1)‿ap‿bp }