Skip to content

Instantly share code, notes, and snippets.

@0b5vr
Created May 12, 2017 09:19
Show Gist options
  • Save 0b5vr/c135ca5b173ed7d46eec756dc7064787 to your computer and use it in GitHub Desktop.
Save 0b5vr/c135ca5b173ed7d46eec756dc7064787 to your computer and use it in GitHub Desktop.
pi $0, si 0
pi $1, si 1
pi $2, si 2
pi $4, si 4
pi $8, si 8
pi $32, si 32
pi $64, si 64
pi $96, si 96
pi $128, si 128
// === setup ===
pi $x, si 0
pi $y, si 0
@setup
pi $sin, si 0, rnd $0
pi $c, s $sin, div $2, sub $64, sin $c
x $x, y $y, zi 4, s $c
pi $c, s $sin, sub $64, sin $c, div $2, add $64
x $x, y $y, zi 5, s $c
pi $c, s $sin, sub $32, sin $c, div $2, add $64
x $x, y $y, zi 6, s $c
pi $x, add $1, seq $0, j @setup
pi $y, add $1, seq $0, j @setup
// === update ===
@update
pi $i0, si 0
pi $i1, si 0
@circloop
pi $x, si 0, rnd $0
pi $y, si 0, rnd $0
x $x, y $y, zi 4, g $cr
x $x, y $y, zi 5, g $cg
x $x, y $y, zi 6, g $cb
pi $ii, si 0
@putloop
pi $ts, rnd $4, add $4
pi $tx, rnd $ts, add $x
pi $ty, rnd $ts, add $y
x $tx, y $ty, zi 6, s $cb
zi 5, s $cg
zi 4, s $cr
pi $ii, add $1, seq $8, j @putloop, si 0
pi $i0, add $1, seq $0, j @circloop
pi $i1, add $1, seq $4, j @circloop
// === glitch ===
pi $x, si 0, rnd $x // $x = random()
pi $y, si 4, rnd $y // $y = random() (in range of 0 - 3)
pi $v, si 0, rnd $v // $v = random()
x $x, y $y, zi 1, s $v // GLITCH!!
pi $_, si 10, w $_
j @update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment