<p class="p-anima-4 __anima" id="js-anima-4">
	<span>Your guess is as good as mine</span>
</p>

<button type="button" data-reload="js-anima-4" id="js-reload">リロード</button>
.p-anima-4 {
  display: flex;
	justify-content: center;
}
.p-anima-4 span {
  display: block;
  color: #fff;
  background-color: #333;
  font-size: 20px;
  font-weight: bold;
  padding: 2px 8px;
  position: relative;
	clip-path: inset(0 100% 0 0);
}
.p-anima-4.__anima span {
	animation: anima_4 0.4s linear forwards;
}

@keyframes anima_4 {
  0% {
		clip-path: inset(0 100% 0 0);
  }
  100% {
		clip-path: inset(0);
  }
}

/* アニメーションとは関係のないスタイル(ボタンの見た目など) */
body {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	height: 100vh;
}
button {
	margin-top: 40px;
}
document.querySelector('#js-reload').addEventListener('click', (_ev) => {
	const target = _ev.target.getAttribute('data-reload');
	document.querySelector(`#${target}`).classList.remove('__anima');
	setTimeout(() => {
		document.querySelector(`#${target}`).classList.add('__anima');
	}, 500);
});
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.