JSFiddle - React, Tailwind, and code Playground
HTML
<div id="line1">gfceetyxotezibswjcdh</div>
<div id="line2">oeefgjciehyxswtcdbtz</div>
<div id="moves">11:u 11:r 11:r 11:r 11:r 11:r 11:r 11:r 11:r 9:u 9:r 9:r 9:r 9:r 9:r 9:r 9:r 9:r 9:r 13:u 13:r 13:r 13:r 13:r 5:u 5:r 5:r 5:r 5:r 5:r 5:r 5:r 5:r 5:r 1:u 1:r 1:r 8:d 8:l 8:l 8:l 8:l 8:l 8:l 8:l 8:l 3:d 3:l 3:l 4:d 4:l 4:l 16:d 16:l 16:l 16:l 16:l 16:l 16:l 16:l 16:l 16:l 16:l 16:l 12:d 12:l 12:l 12:l 12:l 12:l 10:d 10:l 10:l 19:d 19:l 19:l 19:l 19:l 19:l 19:l 19:l 19:l 19:l 19:l 0:r 2:r 7:r 14:l 17:l 0:r 2:r 6:r 7:r 14:l 15:l 18:l 0:r 2:r 6:r 7:r 15:l 17:l 0:r 2:r 6:r 7:r 18:l 6:r 11:d 9:d 13:d 5:d 1:d 8:u 3:u 4:u 16:u 12:u 10:u 19:u</div>
CSS
#line1 {position:absolute;top:100px;}
#line2 {color:gray;position:absolute;top:250px;}
#moves {display:none;}
span {float:left;font-family:monospace;font-size:50px;position:absolute;width:50px;}
JavaScript
$('div:not(#moves)').each(function(){
c = $(this).text().split("");
$this = $(this);
$this.empty();
i = 0;
$.each(c, function(x, y) {
$this.append("<span>" + y + "</span>");
$('span').last().css({top: "0px", left: (i++ * 50) + "px"});
});
});
moves = $('#moves').text().split(" ");
function animateNextMove() {
m = moves.shift().split(":");
if (m[1] == 'l') o = {left:"-=50"};
if (m[1] == 'r') o = {left:"+=50"};
if (m[1] == 'u') o = {top:"-=50"};
if (m[1] == 'd') o = {top:"+=50"};
$('#line1 span:nth-child(' + ++m[0] + ')').animate(o, 125, 'linear', animateNextMove);
}
animateNextMove();