{"action":"created","issue":{"url":"https://api.github.com/repos/gre/bezier-easing/issues/24","repository_url":"https://api.github.com/repos/gre/bezier-easing","labels_url":"https://api.github.com/repos/gre/bezier-easing/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/gre/bezier-easing/issues/24/comments","events_url":"https://api.github.com/repos/gre/bezier-easing/issues/24/events","html_url":"https://github.com/gre/bezier-easing/issues/24","id":163339898,"number":24,"title":"Looking to make complex curves","user":{"login":"lukebatchelor","id":18694878,"avatar_url":"https://avatars.githubusercontent.com/u/18694878?v=3","gravatar_id":"","url":"https://api.github.com/users/lukebatchelor","html_url":"https://github.com/lukebatchelor","followers_url":"https://api.github.com/users/lukebatchelor/followers","following_url":"https://api.github.com/users/lukebatchelor/following{/other_user}","gists_url":"https://api.github.com/users/lukebatchelor/gists{/gist_id}","starred_url":"https://api.github.com/users/lukebatchelor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukebatchelor/subscriptions","organizations_url":"https://api.github.com/users/lukebatchelor/orgs","repos_url":"https://api.github.com/users/lukebatchelor/repos","events_url":"https://api.github.com/users/lukebatchelor/events{/privacy}","received_events_url":"https://api.github.com/users/lukebatchelor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-07-01T07:56:37Z","updated_at":"2016-07-04T09:36:50Z","closed_at":"2016-07-02T09:35:21Z","body":"First of all, this is an awesome library! I spent a long time looking for implementations a couple of weeks ago and didn't find this.\r\n\r\nI'm looking at using this for some animations we are working on where we have some complex animation curves and I was wondering if you might be able to confirm if my idea should work, and also whether you might like it as a PR for this repo.\r\n\r\nSo, what we need is a way to specify curves with multiple control points and still interpolate from 0 -> 1.\r\n![](http://i.imgur.com/CrQLMAJ.png)\r\n\r\nThis one, for example,  does 80% of its movement in the first 20% of time and the final 20% in the last 80% of time.\r\n\r\nThe curve for the first bit is `[0.23830050393398, 0, 0.25586732616931, 0.79011192334632]` and the second is `[0.21787238302442, 0.98324004924648, 0.58694150667646, 1]`.\r\n\r\nWhat I'm planning is something taking a list of points and control points and be able to use them as if they were one curve:\r\n\r\n```\r\nvar curve = [{\r\n\tcp: [0.23830050393398, 0, 0.25586732616931, 0.79011192334632],\r\n}, {\r\n\tcp: [0.21787238302442, 0.98324004924648, 0.58694150667646, 1],\r\n\tp: [0.2, 0.8] // first curve will finish at [0.2, 0.8], rest of the curve follows the cp above\r\n}];\r\n\r\nvar easing = cubicBezier(curve);\r\n\r\neasing(0); // = 0\r\neasing(0.2); // = 0.8 because we are at the end of the first curve\r\neasing(1); // 1\r\n```\r\n\r\nSo, the first curve would go from 0 -> 0.2, you would take the values from the curve and times them by 0.2 (because a 1 from the first curve would put you at 0.2 on the total curve). The second curves values would be 0.2 + 0.8*secondCurve.\r\n\r\nI imagine it would work that, a single control point wouldnt need a `p` value because it would go from 0 -> 1 as normal, for two onwards you have `p` to tell you where the last curve finished.\r\n\r\nSo my two questions, does this work out mathematically as far as you can tell? And would you like a PR when I try this later?\r\n\r\nThanks again"},"comment":{"url":"https://api.github.com/repos/gre/bezier-easing/issues/comments/230248709","html_url":"https://github.com/gre/bezier-easing/issues/24#issuecomment-230248709","issue_url":"https://api.github.com/repos/gre/bezier-easing/issues/24","id":230248709,"user":{"login":"gre","id":211411,"avatar_url":"https://avatars.githubusercontent.com/u/211411?v=3","gravatar_id":"","url":"https://api.github.com/users/gre","html_url":"https://github.com/gre","followers_url":"https://api.github.com/users/gre/followers","following_url":"https://api.github.com/users/gre/following{/other_user}","gists_url":"https://api.github.com/users/gre/gists{/gist_id}","starred_url":"https://api.github.com/users/gre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gre/subscriptions","organizations_url":"https://api.github.com/users/gre/orgs","repos_url":"https://api.github.com/users/gre/repos","events_url":"https://api.github.com/users/gre/events{/privacy}","received_events_url":"https://api.github.com/users/gre/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T09:36:50Z","updated_at":"2016-07-04T09:36:50Z","body":"@lukebatchelor https://github.com/gre/bezier-easing-editor"}}
{"actor":{"display_login":"gre"}}