КС
Size: a a a
КС
МТ
КС
КС
КС
МТ
КС
КС
КС
МТ
МТ
КС
МТ
КС
КС
КС
КС
КС
<script>
// ...
$: if (isVisible) visible = true;
function animate(node, isVisible) {
gsap.to(node, {
// initAnimation
});
return {
update(isVisible) {
gsap.to(node, {
// destroyAnimation,
onComplete: () => visible = false
});
}
};
}
</script>
<button on:click={() => isVisible = !isVisible}>Toggle</button>
{#if visible}
<div use:animate={isVisible}>content</div>
{/if}
КС
МТ