The update causes X and Y positions to be updated. The movement of the words are controlled by a Velocity variable. By decreasing Velocity we create a “Ease out” effect.
for (let i = 0; i < window.clouds.length; i++) { let cloud = window.clouds[i]; cloud.Update(canvas); cloud.Draw(ctx); }
ctx.font = '12px serif';
let len = window.wordList.length; let toRemove = [];
for (let i = 0; i < len; i++) { let word = window.wordList[i]; word.Update(); word.Draw(ctx);
if (word.IsStopped()) { toRemove.push(word); } }
toRemove.forEach(word => { const index = window.wordList.indexOf(word); if (index > -1) { window.wordList.splice(index, 1); // 2nd parameter means remove one item only } }); }