// licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
//Inspired by corrupted screensaver, by Ritchse - instagram.com/ritchse_jp

s0.initImage("/home/pln/Work/Hydra/img/portrait_rhadamanthe.jpg")
src(s0)
.scale(1.8)
// .scroll(() => 0 + 0.01 * Math.sin(time),() => 0.01 + 0.02 * Math.cos(time/3))
.mult(voronoi(100,0.01).mask(shape(30).scale(2)),() => 0.25 + 0.5 * Math.sin(time/10))
.out(o0)

voronoi(1330,0.015)
  	.modulateScale(osc(18,0.001)
      .rotate(() => Math.sin(time/13))
      ,100)
  .thresh(.8)
	.modulateRotate(osc(7,0.05 * Math.abs(Math.sin(time/4))),0.02)
	.thresh(0.05)
  .diff(
    src(o1).scale(() => 1.4 + 0.28 * Math.sin(time/13))
  )
	.modulateScale(
    osc(18,0.01).modulateRotate(o1,.74)
  )
	.diff(src(o1).rotate([-.012,.01,-.002,0]).scrollY(0,[-1/424242,0].fast(0.7)))
	.brightness([-.02,-.1].smooth().fast(.5))
	.out(o1)


src(o0)
  .modulateRotate(src(o1).scroll(0.5),2)
  .modulateScale(o1)
  .diff(o1,0.5)
  .out(o2)

src(o2)
.contrast(1.2)
.saturate(0)
.out(o3)

render()
render(o3)