I somewhat miss those old demos showing the capabilities of computers when they were called x86 instead of i3, i5 and i7. One of the first I watched in my 386 was the Unreal demo from Future Crew that is now celebrating its 25th anniversary. At minute 0:43 the first part of the demo starts and we see a scrolling text following a sinusoidal path. Let's try to imitate that effect in ASCII art!
The challenge
Given this path:
*** ***
*** ***
** **
* *
* *
* *
* *
** **
*** ***
******
and an input text, draw the text following that path, like this:
Thi Golf!
s i de Yay
s Co !
P
r d
o n
g a
ra s
mmi zle
ng Puz
Note that the spaces count as characters in the path, and that the path repeats itself if the text is longer than the sample.
The animation part
Once you have drawn the text, wait for 100 ms (to create an animation of around 10 fps) and draw the text again but starting from the next position of the path. So, for frame #n
, calculate n modulo 40
and start drawing in the following position of the path with the text always aligned to the left of the canvas:
*** ***
| *** *** |
| ** ** |
| * * |
| * * |
| * * |
| * * |
| ** ** |
| *** *** |
| ****** |
Position 0 Position 39
So for frame 10 we will have:
and Co
es de
zl Go
z l
u f
T P !
h
is ng Ya
is mmi y!
Progra
Notes
- Input will be a single
string
(orchar
array, whatever) with the text to animate, and will always have at least 1 character. - Valid characters to animate are those in the printable ASCII set.
- The path to follow will be exactly as given.
- Text will always be aligned to the left of the canvas, so the effect will be the text waving like a flag, with no text displacement. And by canvas I mean screen or whatever you will use to show the text. ;-)
- Frames must be clear of any characters/pixels from previous frames unless the character/pixel is the same in both frames.
- The speed of the animation does not matter as long as it runs smoothly or as fast as your device can (we can set a minimum of 5 fps, but this is not a requirement). Just adjust the speed to make it fluid and do not worry if the waiting times are not exactly the same.
- The animation will loop endlessly.
This is code-golf, so may the shortest program or function capable of animating the text win!