Turn a string into a windmill
JavaScript (ES6), 291 bytes
r=a=>{w.textContent=a.map(a=>a.join``).join`
`;for(i=j=h=a.length>>1;j++,i--;){t=a[i][i];a[i][i]=a[h][i];a[h][i]=a[j][i];a[j][i]=a[j][h];a[j][h]=a[j][j];a[j][j]=a[h][j];a[h][j]=a[i][j];a[i][j]=a[i][h];a[i][h]=t}}
s=w=>{a=[...w=[...w]].map(_=>w.map(_=>' '));a[w.length>>1]=w;setInterval(r,1000,a)}
s("windmills")
<pre id=w>
MATL, 35 33 21 bytes
jtn2/kYaG1$Xd`wtD3X!T
The following will animate the windmill (26 bytes)
jtn2/kYaG1$Xd`wtXxDlY.3X!T
Online Demo
In this version , the Xx
specifies to clear the display and the 1Y.
is a 1-second pause.
Explanation
The basic idea is that we want to create two versions of the input. An "orthogonal" version
+-----+
| |
| |
|abcde|
| |
| |
+-----+
And a "diagonal" version
+-----+
|a |
| b |
| c |
| d |
| e|
+-----+
We push these two versions onto the stack. Each time through the loop, we switch the order of stack and rotate the top one clockwise.
j % Grab the input as a string
t % Duplicate the input
%--- Create the "orthogonal" version ---%
n2/ % Determine numel(input) / 2
k % Round down to nearest integer
Ya % Pad the input string with floor(numel(input)/2) rows above and below
%--- Create the "diagonal" version ---%
G % Grab the input again
1$Xd % Place the input along the diagonal of a matrix
` % do...while loop
w % Flip the order of the first two elements on the stack
t % Duplicate the top of the stack
%--- OCTAVE ONLY (converts NULL to space chars) ---%
O % Create a scalar zero
32 % Number literal (ASCII code for ' ')
XE % Replaces 0 elements in our 3D array with 32 (' ')
%--- END OCTAVE ONLY ---%
D % Display the element
3X! % Rotate this element 90 degrees counter-clockwise 3 times (clockwise)
T % Explicit TRUE to create an infinite loop
% Implicit end of while loop
05AB1E, 88 53 bytes
Code:
¹VYg;ïU[2FX¶×DYsJ,YvNð×y¶J?}YvðX×yJ,}Yv¹gN>-ð×yJ,}YRV
Try it online!. Make sure to hit the kill button right after you run it, because it goes into an infinite loop.