Last active
October 11, 2015 01:58
-
-
Save xl1/3785245 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| precision mediump float; | |
| #define PI 3.14159265359 | |
| attribute vec4 a_position; | |
| uniform mat4 u_projectionMatrix; | |
| uniform vec2 u_textureSize; | |
| uniform vec2 target; | |
| uniform float timing; | |
| vec2 genieEffect(vec2 pos){ | |
| vec2 tgt = target / u_textureSize; | |
| if(timing < 0.475){ | |
| pos.x += timing * (tgt.x - pos.x) * (1.0 - cos(pos.y * PI)); | |
| } else { | |
| pos.y = min(1.0, pos.y + 1.95 * timing - 0.95); | |
| pos.x += 0.475 * (tgt.x - pos.x) * (1.0 - cos(pos.y * PI)); | |
| } | |
| return pos; | |
| } | |
| vec4 getPosition(){ | |
| vec2 pos = a_position.xy + vec2(0.5); | |
| pos = genieEffect(pos) - vec2(0.5); | |
| return vec4(pos, 0.5, 1.0); | |
| } | |
| void main(){ | |
| gl_Position = u_projectionMatrix * getPosition(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment