{"action":"created","issue":{"url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/81","labels_url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/81/comments","events_url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/81/events","html_url":"https://github.com/PolymerElements/neon-animation/issues/81","id":109011099,"number":81,"title":"Cancelling an ongoing animation does not complete animation in progress","user":{"login":"atotic","id":127453,"avatar_url":"https://avatars.githubusercontent.com/u/127453?v=3","gravatar_id":"","url":"https://api.github.com/users/atotic","html_url":"https://github.com/atotic","followers_url":"https://api.github.com/users/atotic/followers","following_url":"https://api.github.com/users/atotic/following{/other_user}","gists_url":"https://api.github.com/users/atotic/gists{/gist_id}","starred_url":"https://api.github.com/users/atotic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atotic/subscriptions","organizations_url":"https://api.github.com/users/atotic/orgs","repos_url":"https://api.github.com/users/atotic/repos","events_url":"https://api.github.com/users/atotic/events{/privacy}","received_events_url":"https://api.github.com/users/atotic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PolymerElements/neon-animation/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-30T04:16:24Z","updated_at":"2015-10-14T01:35:53Z","closed_at":null,"body":"This bug can be demonstrated on neon-animation-demo pages. Go to 'declarative' demo, and flip quickly through the pages. Cancelled animations will cause a lot of blank-page animations.\r\n\r\nReason:\r\n- at the beggining of every animation `neon-animated-pages._selectedChanged` inserts opaque-animation.\r\n- `opaque-animation.configure` sets pages's opacity to 0. It usually removes this flag in `opaque-animation.complete`, which gets called by `animation.onfinish` callback.\r\n- `neon-animated-pages._selectedChanged` will interrupt ongoing animation if selection changes, and this happens when you flip rapidly.\r\n- interrupted animation never gets its onfinish callback called\r\n- so opaque-animation never resets the opacity flag back to original value, and page remains opaque until it is animated again.\r\n\r\nThe fix:\r\n- according to web animation standard, http://w3c.github.io/web-animations/#the-animation-interface, there should be an oncancel event fired when animation is cancelled. web-animations-js does not fire this event.\r\n- neon-animated-pages also does not listen to cancel event\r\n- you could fix this in your code right now with the workaround I use below:\r\n\r\nThe workaround:\r\nIn my code, I call the callback manually before cancellation, and that makes everything run well.\r\n```\r\n        var f = this.lazy._player.onfinish;\r\n        this.lazy._player.onfinish = function() {};\r\n        f.apply(this.lazy._player);\r\n```\r\n\r\nMight be related to #71 and #74 \r\n"},"comment":{"url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/comments/147899969","html_url":"https://github.com/PolymerElements/neon-animation/issues/81#issuecomment-147899969","issue_url":"https://api.github.com/repos/PolymerElements/neon-animation/issues/81","id":147899969,"user":{"login":"hawkett","id":134568,"avatar_url":"https://avatars.githubusercontent.com/u/134568?v=3","gravatar_id":"","url":"https://api.github.com/users/hawkett","html_url":"https://github.com/hawkett","followers_url":"https://api.github.com/users/hawkett/followers","following_url":"https://api.github.com/users/hawkett/following{/other_user}","gists_url":"https://api.github.com/users/hawkett/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkett/subscriptions","organizations_url":"https://api.github.com/users/hawkett/orgs","repos_url":"https://api.github.com/users/hawkett/repos","events_url":"https://api.github.com/users/hawkett/events{/privacy}","received_events_url":"https://api.github.com/users/hawkett/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T01:35:53Z","updated_at":"2015-10-14T01:35:53Z","body":"If this is a duplicate of #71 and #74, then there's a 1 line PR (#75) ready to go that fixes those issues. Is there anything preventing that from being merged?"}}