##JavaScript (ES6), 118 109 107 bytes
The input string is case insensitive.
s=>s.replace(/./g,(c,i)=>(d=~~s-(s=parseInt(c,36)),i)?'<><>'[k=d/13+2|0].repeat([d+26,-d,d,26-d][k])+'*':c)
###How it works
Unlike Python, the JS modulo operator returns a number having the same sign as the dividend rather than the divisor. Also, the JS repeat()
method throws an error when given a negative number, rather than returning an empty string (and it's significantly longer than a simple *
anyway).
These are rather unfavorable behaviors for this challenge. So, we'd better identify in which exact case we are rather than relying on math tricks. (Which doesn't mean that such tricks do not exist, but rather that I failed to find them.)
Below is a table describing the 4 possibles cases, where d
is the signed distance between the current character and the previous one:
d | floor(d / 13) + 2 | direction | distancerepeat
------------+-------------------+------------+---------
-25 ... -14 | 0 | < | d + 26
-13 ... -1 | 1 | > | -d
+0 ... +12 | 2 | < | +d
+13 ... +25 | 3 | > | 26 - d
###Test cases
let f =
s=>s.replace(/./g,(c,i)=>(d=~~s-(s=parseInt(c,36)),i)?'<><>'[k=d/13+2|0].repeat([d+26,-d,d,26-d][k])+'*':c)
console.log(f("abcdef"));
console.log(f("zyaf"));
console.log(f("zzzzzz"));
console.log(f("z"));
console.log(f("zm"));
console.log(f("zl"));
console.log(f("alphabet"));
console.log(f("banana"));
console.log(f("abcdefghijklmnopqrstuvwxyz"));
console.log(f("abcdefz"));