#!/usr/pkg/bin/bash
# XScreenSaver, Copyright © 2026 Jamie Zawinski <jwz@jwz.org>
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  No representations are made about the suitability of this
# software for any purpose.  It is provided "as is" without express or 
# implied warranty.

PATH="$PATH":"$(dirname "$0")"
exec -a "bestill" \
xshadertoy "$@" \
 --program0-0 - \
 --program1-0 - \
 --program2-0 - \
 --program3-0 - \
 --program4-0 - \
 --program5-0 - \
<< "_XSCREENSAVER_EOF_"

// Title:  Be Still
// Author: Matt Vianueva <diatribes@gmail.com>
// URL:    https://www.shadertoy.com/view/tfXcRn
// Date:   14-Aug-2025
// Desc:   Be Still

// Relicensed as MIT License, by permission, 8-Mar-2026.


// 0 Image

	void mainImage(out vec4 o, vec2 u) {
	o = vec4(0,0,0,0);
	float d=0.,a=0.,e=0.,i=0.,s=0.,t = iTime*.5;
	vec3  p = iResolution;
	u = (u+u-p.xy)/p.y;
	if (abs(u.y) > .8) { o = vec4(0); return; }
	u += vec2(cos(t*.4)*.3, cos(t*.8)*.1);
	for(o*=i; i++<1e2;
	e = length(p - vec3(
	sin(sin(t*.2)+t*.4) * 2.,
	1.+sin(sin(t*1.3)+t*.2) *1.23,
	12.+t+cos(t*.5)*8.))-.1,
	d += s = min(.01+.4*abs(s),e=max(.8*e, .01)),
	o += 1./(s+e*4.))
	for (p = vec3(u*d,d+t),
	s =4.+p.y+p.x*.3,
	a = .42; a < 16.; a += a)
	s -= abs(dot(sin(.6*t+p * a ), .18+p-p)) / a;
	u += (u.yx*.7+.2-vec2(-1.,.1));
	o = tanh(vec4(4,2,1,0)*o/1e1/dot(u,u));
	}

.
// 1 Image

	void mainImage(out vec4 o, vec2 u) {
	o = vec4(0,0,0,0);
	float d=0.,a=0.,e=0.,i=0.,s=0.,t = iTime*.5;
	vec3  p = iResolution;
	u = (u+u-p.xy)/p.y;
	if (abs(u.y) > .8) { o *= 0.; return; }
	vec2 v = u.yx*.7 + vec2(1.2,.1);
	float l1 = 2./length(u + v),
	l2 = 2./length(u - v);
	u += cos(t*vec2(.4,.8)) * vec2(.3,.1);
	for(o*=0.; i++<1e2;
	e = length(p - vec3(
	sin(sin(t*.2)+t*.4) * 2.,
	1.+sin(sin(t*1.3)+t*.2) *1.23,
	12.+t+cos(t*.5)*8.))-.1,
	d += s = min(.01+.4*abs(s),e=max(.8*e, .01)),
	o += 1e2/(s+e*4.)+ l1 + l2)
	for (p = vec3(u*d,d+t),
	s =5.+p.y+cos(p.x*.1)*4.,
	a = .01; a < 3.; a += a)
	s -= abs(dot(sin(.2*p.z+.6*t+p / a ), .4+p-p)) * a;
	o = tanh(vec4(5,2,1,0)*o*o*o/1e9);
	}

.
// 2 Image

	void mainImage(out vec4 o, vec2 u) {
	o = vec4(0,0,0,0);
	float d=0.,a=0.,e=0.,i=0.,s=0.,t = iTime*.5;
	vec3  ep, p = iResolution;
	u = (u+u-p.xy)/p.y;
	u += vec2(cos(t*.4)*.3, cos(t*.8)*.1);
	for(o*=i; i++<1e2;
	d += s = min(.02+.6*abs(s),e=max(.8*e, .01)),
	o += 1./(s+e*2.))
	for (p = vec3(u*d,d+t),
	ep = p - vec3(
	sin(sin(t)+t*.4) * 8.,
	sin(sin(t)+t*.2) *2.,
	16.+t+cos(t)*8.),
	e = length(ep) - .1,
	s = mix(e*.02,4.+p.y, smoothstep(0., 12., length(ep))),
	a = .4; a < 8.; a *= 1.4)
	s -= abs(dot(cos(t+.2*p.z+p * a ), .11+p-p)) / a;
	o = tanh(vec4(1,2,6,0)*o/1e1/length(u-.65));
	}

.
// 3 Image

	#define O(Z,c) ( length(                    \
	p - vec3( sin( t*c*24. ) * 16.,        \
	sin( t*c*18. ) * 12. + 12.,  \
	Z+t+t+cos(t*.5)*32. )  ) - c )
	void mainImage(out vec4 o, vec2 u) {
	o = vec4(0,0,0,0);
	float i=0.,e=0.,a=0.,d=0.,s=0.,t=iTime;
	vec3  p = iResolution;
	u = (u-p.xy/2.)/p.y;
	if (abs(u.y) > .4) { o = vec4(0); return; }
	u += vec2(cos(t*.4)*.3, cos(t*.8)*.1);
	vec2 v = u - (u.yx*.8+.2-vec2(-.2,.1));;
	float light = dot(v,v);
	for(o*=i; i++<80.;
	d += s = min(e, .06 + abs(s)*.3),
	o += 1./s + 1e2/e + 1. / light)
	for (p = vec3(u*d,d+t+t),
	e = max( .8* min( O( 3e1, .03),
	min( O( 4e1, .06),
	min( O( 5e1, .09),
	min( O( 6e1, .12),
	O( 7e1, .15) )))), .001 ),
	s = 6. + p.y,
	a = .05; a < 2.; a += a)
	s -= abs(dot(sin(t+.3*p / a), .6+p-p)) * a;
	o = tanh(vec4(1,2,5,0)*o*o /4e6);
	}

.
// 4 Image

	void mainImage(out vec4 o, vec2 u) {
	o = vec4(0,0,0,0);
	float
	i=0.,
	d=0.,
	s=0.,
	e=0.,
	t=iTime,
	zt = t * 12.,
	xt = t * 13.;
	vec3 p = iResolution;
	u = (u+u-p.xy)/p.y+cos(t*.3)*vec2(.4,.2);
	for(o*=i; i++<128.;
	d += s = min(e, min(1.+ p.y*.6, 5.-p.y*.05)),
	o += s + 3./e)
	for(p = vec3(u*d,d+zt),
	e = length(p - vec3(
	sin(sin(t*.2)+t*.4)*4.,
	sin(sin(t*1.3)+t*.2)*2.,
	14.+zt+cos(t*.5)*8.))-.1,
	p.x -= xt,
	s = .02;
	s < 2.;
	s += s)
	p += abs(dot(sin(p * s), p-p+.12)) / s;
	u += (u.yx*.7+.2-vec2(-1.,.1));
	o = tanh(vec4(5,2,1,0)*o*o/d/1e3/length(u));
	}

.
// 5 Image

	void mainImage( out vec4 o, vec2 u ) {
	o = vec4(0,0,0,0);
	float s=.3,i=0.,n=0.;
	vec3 r = iResolution,p=vec3(0,0,0);
	for(u = (u-r.xy/2.)/r.y-s; i++ < 32. && ++s>.001;)
	for (p += vec3(u*s,s),s = p.y,
	n =.01; n < 1.;n+=n)
	s += abs(dot(sin(p.z + iTime + p/n),  r/r)) * n*.1;
	o = tanh(i*vec4(5,2,1,0)/length(u-.1)/5e2);
	}

_XSCREENSAVER_EOF_
