You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/transition-js-events/main.html

45 lines
759 B

{{#each things as thing}}
{{#if visible}}
<p transition:foo>{{thing}}</p>
{{/if}}
{{/each}}
<script>
export default {
transitions: {
foo: function ( node, params ) {
return {
duration: 100,
tick: t => {
node.foo = t;
}
};
}
},
oncreate() {
this.intros = [];
this.outros = [];
this.introCount = 0;
this.outroCount = 0;
this.on('intro.start', ({ node }) => {
this.intros.push(node.textContent);
this.introCount += 1;
});
this.on('intro.end', () => {
this.introCount -= 1;
});
this.on('outro.start', ({ node }) => {
this.outros.push(node.textContent);
this.outroCount += 1;
});
this.on('outro.end', () => {
this.outroCount -= 1;
});
}
};
</script>