PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1/*
 2 * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
 3 * 
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 * 
 8 *     http://www.apache.org/licenses/LICENSE-2.0
 9 * 
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17precision mediump float;
18
19// Uniforms passed in in from CSS
20
21uniform float t;
22uniform float fade;
23
24// Main
25
26void main()
27{
28    // As t increases from [0 -> 0.5 -> 1],
29    // fadeFactor increases and then decreases from [0 -> 1 -> 0].
30    float fadeFactor = 2.0 * t;
31    if (fadeFactor > 1.0)
32        fadeFactor = 2.0 - fadeFactor;
33
34    float currentFade = 1.0 - fadeFactor * fade;
35    css_ColorMatrix = mat4(1.0);
36    css_ColorMatrix[3][3] = currentFade;
37}