gl-transitions/gl-transitions

Reverse of cube?

IdontGetThePointOfMakingAAccountForThis opened this issue · 3 comments

Hello,

I don't know if this thread (I'm completely new to programming and Github) is still used.

Is there a possibility that the cube transition can be reversed?
Like it moves the opposite way?

Greetings,

Salty

Yes , simply change progress changing direction from 1.0 to 0.0 instead of 0.0 to 1.0. Or replace progress by myprogress in transition function and add float myprogress = 1.0 - progress; to the beginning of this function.

Pretty sure it is more complicated than that.
The only progresses happening are

vec4 transition(vec2 op) { float uz = unzoom * 2.0*(0.5-distance(0.5, progress)); vec2 p = -uz*0.5+(1.0+uz) * op; vec2 fromP = xskew( (p - vec2(progress, 0.0)) / vec2(1.0-progress, 1.0), 1.0-mix(progress, 0.0, persp), 0.0 ); vec2 toP = xskew( p / vec2(progress, 1.0), mix(pow(progress, 0.0), 1.0, persp), 1.0

Okay, I already nailed it on my own.

However! The intention of using the cube backwards was because I needed a transition in my editing software (Wondershare Filmora).

Since:

  1. the only directional transition moves the opposite way
  2. they didn't want to give me the OpenGL code of the directional transition;
  3. AND it was buried deep in the source code of Filmora)

I needed to prepare one of these transitions for the coding of my editing software.

Of course a hassle, along with trying out the cube transition and making the perspective flat to make it look like a directional transition.

But now I nailed it and I am extremely excited.

btw here is the modified code

precision mediump float;
#endif
float progress = PREFIX(global_time);
vec2 resolution = iResolution;

vec4 FUNCNAME (vec2 uv) {
  vec2 p = uv + progress * vec2(1.0, 1.0);
  vec2 f = fract(p);
  return mix(
    INPUT2(f),
    INPUT1(f),
    step(0.0, p.y) * step(p.y, 1.0) * step(0.0, p.x) * step(p.x, 1.0)
  );
}

But still, I would like to know the answer for other people who probably would have the same problem