HTML5+CSS on Canvas 3D WebGL (TM) Library
 

fragPos Library Method

Signature: sc.fragPos ()
Class: taccglShaderConfig Class
 

This is initially an empty method that you can override to customize the fragment shader. The code can modify the variables s,t. s and t contain the coordinates of the texture canvas to be accessed. Note that the coordinates are scaled to the range of 0.0...1.0. There are macros TS(s) and TT(t) that can be used scale pixel coordinates. Must be used in combination with taccglShaderConfig.dynTex.

Examples

var s=taccgl.ssc('ShaderSample5').dynTex(); var b=taccgl.actor(document.body).sc(s).dur(2);
b.start()
RUN
<script id="ShaderSample5" type="x-gsgl/x-shader">
:fragPos
if (TS(700.0)<s) s=1.0-s;
</script>
 
var s=taccgl.ssc('ShaderSample6').times().dynTex(); var b=taccgl.actor(document.body).sc(s).dur(2);
b.start()
RUN
<script id="ShaderSample6" type="x-gsgl/x-shader">
:fragPos
s=(1.0-s)*ct+t*(1.0-ct);
t=(1.0-t)*ct+s*(1.0-ct);
</script>
 
var s=taccgl.ssc('ShaderSample7').times().dynTex(); var b=taccgl.actor(document.body).sc(s).dur(2);
b.start()
RUN
<script id="ShaderSample7" type="x-gsgl/x-shader">
:fragPos
s=fract(s*(ct+1.0)*1.0); t=fract(t*(ct+1.0)*1.0);
</script>
 

WebGL™ is a trademark of the Khronos Group Inc.