#include scene_sessions24/util.glsl

vec2 fractal_main(vec2 UV, float t) {
    float i_t = fract(floor(t) / 4.0)*4.0;
    float f_t = fract(t);
    
    float factor = 2.0;
    float edge = 1.0;
    int layer = 0;
    vec2 p = UV*1.1;
    for(; layer<8; layer++){
        if(abs(p.x)>edge){
            p*=factor;
            p.x-=sign(p.x)*2.0;
        }
    }
    p.y += (i_t+elastic(f_t))*18.0/float(layer);
    
    return p;
}