Skip to content

Instantly share code, notes, and snippets.

@me2beats
Created October 12, 2019 02:18
Show Gist options
  • Save me2beats/f6a3686b67c58ffec6453e4aae70cd6a to your computer and use it in GitHub Desktop.
Save me2beats/f6a3686b67c58ffec6453e4aae70cd6a to your computer and use it in GitHub Desktop.
Wipe transition (kivy)
from kivy.uix.screenmanager import ShaderTransition
from kivy.properties import StringProperty
class MyWipeTransition(ShaderTransition):
'''Wipe transition, based on a fragment Shader.
'''
WIPE_TRANSITION_FS = '''$HEADER$
uniform float t;
uniform sampler2D tex_in;
uniform sampler2D tex_out;
void main(void) {
vec4 cin = texture2D(tex_in, tex_coord0);
vec4 cout = texture2D(tex_out, tex_coord0);
gl_FragColor = mix(cout, cin, step(1., tex_coord0.x+t) );
}
'''
fs = StringProperty(WIPE_TRANSITION_FS)
@me2beats
Copy link
Author

Wipe transition.
imo, blurring (blending?) the edges of textures (what the default wipe transition does) is old-fashioned.
So i fixed it

@me2beats
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment