{"action":"closed","issue":{"url":"https://api.github.com/repos/kimmobrunfeldt/progressbar.js/issues/48","labels_url":"https://api.github.com/repos/kimmobrunfeldt/progressbar.js/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/kimmobrunfeldt/progressbar.js/issues/48/comments","events_url":"https://api.github.com/repos/kimmobrunfeldt/progressbar.js/issues/48/events","html_url":"https://github.com/kimmobrunfeldt/progressbar.js/issues/48","id":63126418,"number":48,"title":"The instance of the ProgressBar Shape/Path should be accessible from the step function.","user":{"login":"prodigitalson","id":472815,"avatar_url":"https://avatars.githubusercontent.com/u/472815?v=3","gravatar_id":"","url":"https://api.github.com/users/prodigitalson","html_url":"https://github.com/prodigitalson","followers_url":"https://api.github.com/users/prodigitalson/followers","following_url":"https://api.github.com/users/prodigitalson/following{/other_user}","gists_url":"https://api.github.com/users/prodigitalson/gists{/gist_id}","starred_url":"https://api.github.com/users/prodigitalson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prodigitalson/subscriptions","organizations_url":"https://api.github.com/users/prodigitalson/orgs","repos_url":"https://api.github.com/users/prodigitalson/repos","events_url":"https://api.github.com/users/prodigitalson/events{/privacy}","received_events_url":"https://api.github.com/users/prodigitalson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-20T00:42:07Z","updated_at":"2015-03-22T22:09:26Z","closed_at":"2015-03-22T22:09:26Z","body":"Unless i missed something, when using `ProgressBar.Path` there is no way to get the reference to itself from the `step` function supplied in instantiation unless using some round about referencing method. I would propose this also be passed as an argument to `step` or merged in to the `state` provided to step. \r\n\r\nExample usage would be to animate a progress bar on an irregular shaped custom path (like an arc) and also animate some text like a counter (similar to what is built in to circle and line) and might be achieved with the following:\r\n\r\n    var svgPath = document.getElementById('svgPath'),\r\n          counter = document.getElementById('counter');\r\n\r\n    var p = new ProgressBar.Path(svgPath, {\r\n          duration: 800,\r\n          from: { strokeOffset: svgPath.getTotalLength() },\r\n          to: { strokeOffset: 0 },\r\n          attachment: { path: svgPath, counter: counter },\r\n          // here self would be a ref to the ProgressBar.Path instance\r\n          step: function (state, attachment, self) {\r\n              attachment.path.setAttribute('strokeOffset', state.strokeOffset);\r\n              attachment.counter.innerHTML = (self.value()*100);\r\n          }\r\n    });\r\n\r\n    p.animate(0.75);"}}