Codidact post, CGCC Sandbox, Codidact Sandbox
Given three positive integers as input, animate an ascii-art polygonal loading symbol on the screen.
Intro
You will be given three inputs, \$n\$, \$l\$, and \$d\$...
\$n\$ (one of \$3\$, \$4\$, \$6\$, or \$8\$), is the number of sides of a polygon:
* * *
* *
* * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * *
\$l\$ is the side length to use. (The above all use \$l = 3\$, the minimum possible value).
You may use any printable ASCII character other than space instead of *
.
\$d\$ is the load length and is less than the perimeter.
The task is to create a loading animation as follows:
- Make the first frame of the animation by starting at any one of the topmost corners and drawing the perimeter until its length is \$d\$.
- Make the next frame by shifting this partial perimeter by 1 clockwise.
- Repeat step 2 ad-infinitum.
For example, \$n=3,l=3,d=4\$ would result in the following steps:
* * * *
* -> * -> * -> * -> * * -> * * -> . . .
* * * * * * * * * * * *
Example
Here is a solution made by Hakerh400: Try It Online!
Further details(important):
- You are guaranteed that \$n∊(3,4,6,8)\$
- You are guaranteed that \$l≥3.\$ You are guaranteed that \$d<(l-1)×n.\$
- There must be a delay of at least 0.1 s between each step. You can have a delay of up to 10 seconds.
- Your language is allowed to output a list of steps infinitely if and only if it cannot clear the screen or do something similar.
- If so, there must be at least 2 newlines between each step.
- This is not graphical-output.
Scoring
This is code-golf. Shortest answer in each language wins.