Closed DevelopwithTom closed 5 years ago
This problem was caused by the CSS for my background image - 'align-items: center;'
Deleting it solved my problems!
Using someones example in another issue, I also sorted it out by feeding the length of the string to the count:
const TypeWriter = () => {
const [count, setCount] = useState(1);
useEffect(() => {
setCount(1);
}, [count]);
return (
<div style={{ color: 'white' }}>
{count ? (
<Typist
avgTypingDelay={40}
startDelay={800}
cursor={{ blink: true }}
onTypingDone={() => setCount(0)}
>
{messages.map((mssg, index) => (
<span key={index}>
{mssg}
<Typist.Backspace count={mssg.length} delay={1500} />
</span>
))}
<Typist.Backspace count={20} delay={1500} />
</Typist>
) : (
''
)}
</div>
);
};
I'm using typist to generate a typed effect title for a website.
However, I have multiple lines of text and each time a line break occurs, the text that has already been typed it pushed upward (see gif).
Can this be stopped and can the new line of text appear below the previously typed text. I have seen it done before but cannot replicate it (like this).
My JS:
My CSS: