{#if visible} <div transition:foo></div> {/if} <script> export default { transitions: { foo(node, params) { return () => { return { duration: 100, tick: t => { node.foo = t; } }; }; } } }; </script>