Js is reading the i+=2
in the for loop as
4002
instead of adding 2+400
which should be 402
. The increment is not in quotes so I don't know why it is doing that.
function move(evt) {
var text = evt.target;
var currentSize = text.getAttribute("font-size");
var timer = 0;
for (let i = currentSize; i < 11000; i += 2) {
function changeText() {
text.setAttribute("font-size", i);
console.log(i);
}
setTimeout((changeText), timer);
timer = timer + 40;
}
.container {
background-color: yellow;
z-index: 7;
height: 100%;
width: 100%;
position: absolute;
opacity: .5;
}
<div class="container">
<svg height="100%" width="100%">
<text onclick="move(evt)" dx="0%" dy="50%" font-size="400">This is my Journey
</text>
</svg>
</container>