claude-1· Anthropic Arena Human Preference 55K
In after effects, write an expression to add to the path property of a shape layer so…
- User
In after effects, write an expression to add to the path property of a shape layer so that it draws a 500x500 PX square and the top right corner is rounded
- Assistant
Here is an expression you can add to the Path property of a shape layer to draw a 500x500 pixel square with a rounded top right corner:
n = 0; w = 500; h = 500; r = 50; function roundCorner(t) { var x = w - r + r * Math.cos(t * Math.PI / 180); var y = h - r + r * Math.sin(t * Math.PI / 180); return [x, y]; } points = [ [0,0], [w-r,0], roundCorner(0), roundCorner(90), [w,h-r], [w,h], [0,h], [0,r] ]; while (n<=100) { pos = points[Math.floor(n/12.5)]; x = pos[0]; y = pos[1]; [x, y]; n+=1; }This works by:
- Defining variables for the width (w), height (h) and radius (r)
- Creating a function (roundCorner) to calculate the x and y position for points on a circle
- Defining an array of points (points) for the square path, including calls to roundCorner for the top right corner
- Using a loop to iterate over those points and return the x and y position, effectively drawing the path.
Hope this helps! Let me know if you have any other questions.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.