{#if visible} <div transition:foo>hello {name}!</div> {/if} <script> export default { transitions: { foo: function ( node, params ) { global.count += 1; return { duration: 100, tick: t => { node.foo = t; } }; } } }; </script>