Skip to content

Instantly share code, notes, and snippets.

@m0ppers
Created May 26, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0ppers/5827cc08d1ba60dfe8bf46120879086b to your computer and use it in GitHub Desktop.
Save m0ppers/5827cc08d1ba60dfe8bf46120879086b to your computer and use it in GitHub Desktop.
#l 2 8 images/emojis.png
pi $0, si 0
pi $1, si 1
pi $2, si 2
pi $4, si 4
pi $8, si 8
pi $12, si 12
pi $16, si 16
pi $127, si 127
pi $shifter, pi 0
pi $roffset, pi 0
pi $goffset, pi 0
pi $boffset, pi 0
pi $255, si 255
pi $sxoffset, si 160
pi $syoffset, si 2
pi $sw, si 16
pi $sh, si 16
pi $dw, si 64
pi $dh, si 64
@mainloop
pi $x, si 0
@gxloop
pi $sinv, s $x, add $shifter, mul $2
pi $yoffset, sin $sinv, div $8
pi $y, si 0
@gyloop
pi $r, s $y, add $roffset, div $16, mul $16, add $127
pi $g, s $y, sub $goffset, div $16, mul $2
pi $b, s $y, sub $boffset, div $16, mul $4
pi $realy, s $y, add $yoffset
x $x, y $realy, zi 4, s $r
x $x, y $realy, zi 5, s $g
x $x, y $realy, zi 6, s $b
pi $y, add $1, seq $0, j @gyloop
pi $x, add $1, seq $0, j @gxloop
pi $shifter, add $1
/////////////////// ----- GRADIENT END ------
pi $halfdw, s $dw, div $2
pi $halfdh, s $dh, div $2
pi $y, si 0
@yloop
pi $fac1, s $y
pi $fac2, s $sh
pi $div, s $dh
xi 0, yi 1, zi 17, s $fac1, sf $fac2
pi $sy, s $syoffset
pi $_x, si 0
pi $_r, si 0
@ycalc
x $_x, yi 1, zi 17, g $v
pi $_f, s $v, div $div
pi $sy, add $_f
pi $_r2, s $v, mod $div
pi $_r, add $_r2
pi $_f, s $_r, div $div
pi $_r, mod $div
pi $sy, add $_f
pi $_x, add $1
pi $v, seq $0, j @ycalc
pi $x, si 0
@xloop
pi $fac1, s $x
pi $fac2, s $sw
pi $div, s $dw
xi 0, yi 0, zi 17, s $fac1, sf $fac2
pi $sx, s $sxoffset
pi $_x, si 0
pi $_r, si 0
@xcalc
x $_x, yi 0, zi 17, g $v
pi $_f, s $v, div $div
pi $sx, add $_f
pi $_r2, s $v, mod $div
pi $_r, add $_r2
pi $_f, s $_r, div $div
pi $_r, mod $div
pi $sx, add $_f
pi $_x, add $1
pi $v, seq $0, j @xcalc
//pi $sx, s $x, mul $sw, div $dw
x $sx, y $sy, zi 8, g $r
x $sx, y $sy, zi 9, g $g
x $sx, y $sy, zi 10, g $b
x $sx, y $sy, zi 11, g $a
pi $targetx, si 127, sub $halfdw, add $x
pi $targety, si 127, sub $halfdh, add $y
x $targetx, y $targety, zi 12, s $r
x $targetx, y $targety, zi 13, s $g
x $targetx, y $targety, zi 14, s $b
x $targetx, y $targety, zi 15, s $a
pi $x, add $1, seq $dw, j @xloop
pi $y, add $1, seq $dh, j @yloop
zi 4, cpa $12
pi $dw, add $1
pi $dh, add $1
w $1
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!!
j @mainloop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment