mirror of https://github.com/sveltejs/svelte
parent
8c9e93bd62
commit
a86ec67d41
@ -0,0 +1,3 @@
|
||||
export default {
|
||||
error: '<svelte:element> cannot have a animate directive'
|
||||
};
|
||||
@ -0,0 +1,20 @@
|
||||
<script>
|
||||
let tag = 'div';
|
||||
let things = [
|
||||
{ id: 1, name: 'a' },
|
||||
];
|
||||
|
||||
function flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
|
||||
return {
|
||||
duration: 100,
|
||||
css: (t, u) => `transform: translate(${u + dx}px, ${u * dy}px)`
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each things as thing (thing.id)}
|
||||
<svelte:element this={tag} animate:flip></svelte:element>
|
||||
{/each}
|
||||
Loading…
Reference in new issue