{"action":"opened","issue":{"url":"https://api.github.com/repos/sveltejs/svelte/issues/1856","repository_url":"https://api.github.com/repos/sveltejs/svelte","labels_url":"https://api.github.com/repos/sveltejs/svelte/issues/1856/labels{/name}","comments_url":"https://api.github.com/repos/sveltejs/svelte/issues/1856/comments","events_url":"https://api.github.com/repos/sveltejs/svelte/issues/1856/events","html_url":"https://github.com/sveltejs/svelte/issues/1856","id":382441287,"node_id":"MDU6SXNzdWUzODI0NDEyODc=","number":1856,"title":"custom transitions","user":{"login":"janwillemtulp","id":135768,"node_id":"MDQ6VXNlcjEzNTc2OA==","avatar_url":"https://avatars2.githubusercontent.com/u/135768?v=4","gravatar_id":"","url":"https://api.github.com/users/janwillemtulp","html_url":"https://github.com/janwillemtulp","followers_url":"https://api.github.com/users/janwillemtulp/followers","following_url":"https://api.github.com/users/janwillemtulp/following{/other_user}","gists_url":"https://api.github.com/users/janwillemtulp/gists{/gist_id}","starred_url":"https://api.github.com/users/janwillemtulp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janwillemtulp/subscriptions","organizations_url":"https://api.github.com/users/janwillemtulp/orgs","repos_url":"https://api.github.com/users/janwillemtulp/repos","events_url":"https://api.github.com/users/janwillemtulp/events{/privacy}","received_events_url":"https://api.github.com/users/janwillemtulp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-19T23:54:05Z","updated_at":"2018-11-19T23:54:05Z","closed_at":null,"author_association":"NONE","body":"I like to use `d3` to create custom transitions, including when a component is destroyed. Currently, there are several standard transitions available in the `svelte-extras` package. However, it would be great to be able to create custom transitions or do other stuff perhaps before the component is completely removed from the DOM when it is destroyed. I know that using `actions` you can decorate your component, but when an element is removed from the DOM, it's still immediate (except with transitions).\r\n\r\nSo, currently, this is how I achieve custom exit transitions using `d3`:\r\n\r\n```\r\ntransitions: {\r\n      myTransition(node, params) {\r\n\r\n        select(node).select('rect').transition()\r\n          .duration(800)\r\n          .attr('transform', `translate(${params.cellWidth / 2}, ${params.cellHeight / 2})`)\r\n          .attr('width', 0)\r\n          .attr('height', 0)\r\n\r\n        return {\r\n          delay: 800,\r\n          duration: 0\r\n        }\r\n      }\r\n    },\r\n```\r\n\r\nSo, I am returning an object that has a delay that is the same amount as the duration of my custom transition.\r\n\r\nIt works, so that's nice, but obviously it feels like a hack.\r\n\r\nAm I correct that there is currently no 'proper' way to do this? If not, this would be a great feature to add!\r\n\r\nThanks!"}}
{"actor":{"display_login":"janwillemtulp"}}