# Change of color the word in each second, like in a karaoke

I have this text. I need that the first word to change to red in 1 second interval, then the second word, then the third word, until arrive the end of the text.

text = "Experiencie leads us to believe that the motions of physical
bodies are controlled by interactions between them and their
surroundings"

• You seem to be asking someone just to do all your work for you. If you really have no clue, you should start smaller and learn the language in pieces. StringSplit and Style are good places to start. Eventually you'll need Dynamic, which is a course in itself, as well as maybe Refresh/UpdateInterval. Of course there are a bunch of core language functions you'll need to put it all together. – Michael E2 May 19 '18 at 0:30
• I don't know what have you tried, but it's true that you didn't show any code (except the text) in your post, so it makes sense that someone assumes that you have not tried anything. It would be better if you show your existing code and explain where you're stuck at. – user202729 May 19 '18 at 4:20
• The "You seem" refers to the form of the question, which is just an expression of need, and how the question makes your intentions appear. Aside from the fact that you wrote the post, my remark is not meant to be personal, and certainly not a comment on your way of being. The form of the question itself shows no work other than providing an example text to process and seems to ask others, by expressing a need, to do all the rest of the work for you. In fact, I did not think it expressed your way of being -- it's not most people's way either, is it? – Michael E2 May 19 '18 at 13:26
• I work hard very day to learn Mathematica, but there times code don' t work me.Ok I should have put my work. My code was this : Style[Pause[1]; #1, Red, Pause[2]; #2, Red] &["Hello", "here"] – Andres May 19 '18 at 14:09

ss = StringSplit[text];
Dynamic @ Row[MapAt[Style[#, Red] &, ss, {Clock[{1, Length@ss, 1}, Length@ss, 3]}], "  "]


• This was what I really needed, thank you @kglr, your code was very useful and precise. – Andres May 19 '18 at 14:18
• I need to exposure a work of the eye human, and with your code finally can do it. I modified your code (apologize for that), changed Row by Column, and the number 3 for 1. – Andres May 19 '18 at 14:52
• @Andres, glad it was useful for you. – kglr May 19 '18 at 20:58

One possible way. Can be optimized more I suppose.

text = "Experiencie leads us to believe that the motions of physical
bodies are controlled by interactions between them and their
surroundings";

words = StringSplit[text];
i = 1;
Manipulate[
ticks = Not[ticks];
Pause[delay];
colored = Table[If[n == i, Style[words[[n]], Red], words[[n]]], {n, 1,
Length@words}];
i = Mod[i, Length@words];
i++;
Row[Riffle[colored, " "]],

{{delay, 0.5, "delay"}, 0.1, 3, 0.1, Appearance -> "Labeled"},
{{ticks, True}, None},
TrackedSymbols :> {ticks,delay}
]

• Thanks, @Nasser. – Andres May 19 '18 at 2:59