Stéphane Laurent
Stéphane Laurent

Reputation: 84719

Reproducing a shader with pixi.js

I'm trying to reproduce this shadertoy with pixi.js. I am lost because there's no fragCoord and no fragColor in the code. Moreover I don't understand the declarations in the loop. Here is one of my numerous attempts:

   precision mediump float;
    uniform vec2 iResolution;
    uniform float iTime;


    void main(){
      vec4 O = vec4(0.0);
      vec2 F = gl_FragCoord.xy;
      vec2 r = iResolution.xy;
      float i = .3;
      float l = length(F+=F-r)/r.y + i;
      float t = iTime;

      for(O *= 0.; i < 12.; O += length(min(r.y/abs(F),r)) / 300.0*(cos(++t+i+vec4(0,1,2,0))*l+l)) {
         F *= mat2(cos(l*.2-i++*--t/1e2+vec4(0,33,11,0)));
      }
      gl_FragColor = O;
     }

I get an error: 'for' : Invalid init declaration. How to reproduce this shadertoy with pixi.js? Can it be due to the version? (I'm using an old one).

Upvotes: 0

Views: 129

Answers (0)

Related Questions