
<user>
Animates a 6x6 round square pattern with alternating moving row directions.
</user>

<system>
// **Overall thinking process: To animate a 6x6 round square pattern with alternating moving row directions, we start by scaling the UV coordinates to create a 6x6 grid. We then animate two sets of UV coordinates: one moving left and the other moving right based on the current time. Using the fractional parts of these animated UV coordinates, we create alternating row directions using a mask derived from the floor and modulus operations. Finally, we interpolate between the left and right moving patterns based on the mask and generate the final pattern using a rounded rectangle shape function. This achieves the desired animated pattern effect with alternating row movements.
// Obtain UV coordinates
vec2 uv; 
UV(uv); 

// Scale the UV coordinates by 6 to create a 6x6 grid pattern
vec2 scaledUV; 
TilingAndOffset(uv, vec2(6, 6), vec2(0, 0), scaledUV); 

// Separate the X and Y components of the scaled UV coordinates
float uvX; 
float uvY; 
Split(scaledUV, uvX, uvY, -, -); ////If you want to use the any component of a vector, use the Split function to store the needed value in a float variable

// Define two UV coordinates: one moving left, another moving right
// Use time to animate the movement

// Get the current time used for animation
float t; 
Time(t, -, -, -, -); 

// Animate the left-moving UV pattern by adding time to the X-coordinate
float uvLeftX; 
Add(uvX, t, uvLeftX); 
vec2 uvLeft; 
Vector2(uvLeftX, uvY, uvLeft); 

// Get the fractional part of the left-moving UV pattern
vec2 fracLeft; 
Fraction(uvLeft, fracLeft); 

// Animate the right-moving UV pattern by adding time to the negated X-coordinate
float uvXnegate; 
Negate(uvX, uvXnegate); 

float uvRightX; 
Add(uvXnegate, t, uvRightX); 
vec2 uvRight; 
Vector2(uvRightX, uvY, uvRight); 

// Get the fractional part of the right-moving UV pattern
vec2 fracRight; 
Fraction(uvRight, fracRight); 

// Create a mask to alternate row directions
// Calculate the floor value of the scaled UV coordinates
vec2 flooredUV; 
Floor(scaledUV, flooredUV); 

// Extract the Y component of the floored UV coordinates
float flooredUVY; 
Split(flooredUV, -, flooredUVY, -, -); ////If you want to use the any component of a vector, use the Split function to store the needed value in a float variable

// Determine the mask using modulus operation to get horizontal stripes
float mask; 
Modulo(flooredUVY, 2, mask); 

// Interpolate between the left and right moving patterns based on the mask
vec2 finalUV; 
Lerp(fracLeft, fracRight, mask, finalUV); 

// Generate the final pattern using a rounded rectangle shape
float result; 
RoundedRectangle(finalUV, 0.5, 0.5, 0.1, result);
</system>