/shaders/fragment/tile-explosion.fs
https://github.com/ajanthanm/cssfilterlab · F# · 37 lines · 27 code · 6 blank · 4 comment · 2 complexity · d4ba54882490a9129de809ed43f3955e MD5 · raw file
- /*
- * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- precision mediump float;
- // Uniforms passed in in from CSS
- uniform float t;
- uniform float fade;
- // Main
- void main()
- {
- // As t increases from [0 -> 0.5 -> 1],
- // fadeFactor increases and then decreases from [0 -> 1 -> 0].
- float fadeFactor = 2.0 * t;
- if (fadeFactor > 1.0)
- fadeFactor = 2.0 - fadeFactor;
- float currentFade = 1.0 - fadeFactor * fade;
- css_ColorMatrix = mat4(1.0);
- css_ColorMatrix[3][3] = currentFade;
- }