Shader "URP/Effects/Particle/Test/UV Scale"
{
	Properties
	{
		_Color("Color", Color) = (0,0,0,0)
		_Texture("Texture", 2D) = "white" {}
		_Mask("Mask", 2D) = "white" {}
		_Speed("Speed", Float) = 0
		[Toggle(_ANIUVSCALE_ON)] _AniUVScale("Ani UV Scale", Float) = 0
		_UVScale("UV Scale", Range( 0 , 1)) = 0
	}
	
	SubShader
	{
		
		Tags { "RenderType"="Transparent" }

		CGINCLUDE
		#pragma target 3.0
		ENDCG

		Blend SrcAlpha One, SrcAlpha One
		AlphaToMask Off
		Cull Off
		ZWrite On
		ZTest On
		
		
		
		Pass
		{
			CGPROGRAM

			#pragma vertex vert
			#pragma fragment frag
			#include "UnityCG.cginc"
			#pragma shader_feature_local _ANIUVSCALE_ON

			struct appdata
			{
				float4 vertex : POSITION;
				float4 color : COLOR;
				float4 texcoord : TEXCOORD0;
			};
			
			struct v2f
			{
				float4 vertex : SV_POSITION;
				float4 texcoord1 : TEXCOORD1;
				float4 color : COLOR;

			};

			sampler2D _Texture;
			float4 _Texture_ST;
			sampler2D _Mask;
			float _UVScale;
			float _Speed;
			float4 _Color;

			
			v2f vert ( appdata v )
			{
				v2f o;
				o.texcoord1.xy = v.texcoord.xy;
				o.color = v.color;
				o.texcoord1.zw = 0;
				float3 vertexValue = float3(0, 0, 0);
				vertexValue = vertexValue;
				o.vertex = UnityObjectToClipPos(v.vertex);
				return o;
			}
			
			fixed4 frag (v2f i ) : SV_Target
			{
				fixed4 finalColor;
				float2 uv_Texture = i.texcoord1.xy * _Texture_ST.xy + _Texture_ST.zw;
				float4 tex2DNode15 = tex2D( _Texture, uv_Texture );
				float2 uv = i.texcoord1.xy * float2( 1,1 ) + float2( 0,0 );
				float2 temp_cast_0 = (0.5).xx;
				#ifdef _ANIUVSCALE_ON
				float Switch = fmod( ( _Time.y * _Speed ) , 1.0 );
				#else
				float Switch = _UVScale;
				#endif
				float2 temp_cast = (0.5).xx;
				float2 Lerp = lerp( ( uv + ( ( uv - temp_cast_0 ) / Switch ) ) , temp_cast , Switch);
				float2 Clamp = clamp( Lerp , float2( 0,0 ) , float2( 1,1 ) );
				float4 tex2DNode14 = tex2D( _Mask, Clamp );
				float3 append01 = (float3(( tex2DNode15 * tex2DNode14 * _Color * i.color ).rgb));
				float4 append02 = (float4(append01 , ( tex2DNode15.r * tex2DNode14.r * _Color * i.color.a ).r));
				finalColor = append02;
				return finalColor;
			}
			ENDCG
		}
	}
}