常用於loading動畫之類的


具體的實現代碼:
fixed4 frag (v2f i) : SV_Target
{
//1.先將uv平移到原點(讓圖片中心與原點重合)
float2 pianyi=(0.5,0.5);
float2 tempUV=i.uv;
tempUV -= pianyi;
//距離圓心超過0.5的點渲染為透明
if(length(tempUV)>0.5){
return fixed4(0,0,0,0);
}
float2 finalUV=0;
float angle=_Time.x*_Speed;
//2.確定是按照z軸旋轉,選取旋轉公式
finalUV.x=tempUV.x * cos(angle) - tempUV.y*sin(angle);
finalUV.y=tempUV.x * sin(angle) + tempUV.y*cos(angle);
//3.將uv還原到以前的位置
finalUV += pianyi;
fixed4 col = tex2D(_MainTex, finalUV);
return col;
}
