Open
Description
I am using the React renderer with precompiled tokens. The tokenization, serialization, and rendering all seem to work fine, but the transitions are all immediate, not animated.
video.mp4
The component looks like this:
const CodePage: React.FC = () => {
const [step, setStep] = useState(0)
return <>
<ShikiMagicMovePrecompiled
steps={compiledCode}
step={step}
animate={true}
options={{ duration: 750, stagger: 7, lineNumbers: true }}
/>
<button onClick={() => setStep(step === 1 ? 0 : 1)}>Animate</button>
</>
}
compiledCode
is generated using this code:
const machine = createMagicMoveMachine(
code => codeToKeyedTokens(highlighter, code, {
lang: "tsx",
theme: "vitesse-light",
})
)
const compiledCode = [
`function greet() {
console.log('Hello, World!');
}
greet();`,
`const name = 'Alice';
function greet() {
console.log('Hello, ' + name + '!');
}
greet();`
].map(code => machine.commit(code).current)
- A full reproduction can be seen at reproduction for #39 #38
Metadata
Metadata
Assignees
Labels
No labels