Seeking assistance in creating a smooth fade-in text animation using CSS in React and Typescript with inline styling. I have attempted to define styles within an object and reference them in the style attribute, but encountered issues. Can anyone offer guidance or suggestions?
Here is a functional example of the desired effect: https://codepen.io/kazed972/pen/bQOQGR
Snippet from my code:
import React from 'react';
const styles = {
// Styling properties here
};
function FadeInText() {
var text = document.getElementById('text') as HTMLElement;
var newDom = '';
var animationDelay = 6;
for (let i = 0; i < text.innerText.length; i++) {
// Logic for generating dynamic span elements
}
// Apply animation delay to each character span element
return (
<div style={styles.center}>
<p id="text">
Lorem ipsum dolor sit amet consectetur adipisicing elit...
</p>
</div>
);
}
export { FadeInText };