{"action":"closed","issue":{"url":"https://api.github.com/repos/specious/cloud9carousel/issues/6","labels_url":"https://api.github.com/repos/specious/cloud9carousel/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/specious/cloud9carousel/issues/6/comments","events_url":"https://api.github.com/repos/specious/cloud9carousel/issues/6/events","html_url":"https://github.com/specious/cloud9carousel/issues/6","id":111839284,"number":6,"title":"Front image scale \"bonus\"","user":{"login":"rolling29","id":15158766,"avatar_url":"https://avatars.githubusercontent.com/u/15158766?v=3","gravatar_id":"","url":"https://api.github.com/users/rolling29","html_url":"https://github.com/rolling29","followers_url":"https://api.github.com/users/rolling29/followers","following_url":"https://api.github.com/users/rolling29/following{/other_user}","gists_url":"https://api.github.com/users/rolling29/gists{/gist_id}","starred_url":"https://api.github.com/users/rolling29/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rolling29/subscriptions","organizations_url":"https://api.github.com/users/rolling29/orgs","repos_url":"https://api.github.com/users/rolling29/repos","events_url":"https://api.github.com/users/rolling29/events{/privacy}","received_events_url":"https://api.github.com/users/rolling29/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-16T14:07:22Z","updated_at":"2015-10-18T20:10:43Z","closed_at":"2015-10-18T20:10:43Z","body":"Hi, I'm not really sure how this works, it's my first time trying to contribute to a project here.  I made a few changes that allow a neat feature and I really like the work you've made available so I wanted to help.  So, here's my little 3 lines change to the rotateItem function:\r\n```javascript\r\n    this.rotateItem = function( itemIndex, rotation ) {\r\n      var item = this.items[itemIndex];\r\n      var sin = Math.sin(rotation);\r\n      var farScale = this.farScale;\r\n      var scale = farScale + ((1-farScale) * ((sin+1) * 0.5));\r\n      // TR 15OCT2015 - I want the front image to be scalable larger than the surrounding images, so...\r\n      var frontscalebonus = 0.4;  // 0.4 gives 40%\r\n      var frontzoom = (Math.pow(sin+1,64)/18446744073709600000) * frontscalebonus; \r\n      var scaleonly = (scale + frontzoom) / (1+frontscalebonus);\r\n      // Allow \"scale\" to continue setting the rotation position, but make the image scale depend on the\r\n      // new \"scaleonly\".  This new var applies a modified sin function to the existing sin function, the\r\n      // goal is to reduce the previous maximum scale to a smaller amount and allow the front image to use \r\n      // the difference as it's expansion factor.  It keeps the rotation positions pretty well intact. My\r\n      // exponential factor makes the small part of the sin curve rapidly peak near Pi/2 and flat elsewhere.\r\n      // That little bit of curve is enough to animate the front image scaling as it slides in and out.\r\n      item.moveTo(\r\n        this.xOrigin + (scale * ((Math.cos(rotation) * this.xRadius) - (item.fullWidth * 0.5))),\r\n        this.yOrigin + (scale * sin * this.yRadius),\r\n      // swap scale for scaleonly below, but not above\r\n        scaleonly\r\n      );\r\n    }\r\n```\r\nI tried to explain it in my comments, but the basic idea is you set a decimal percentage for the frontscalebonus variable, then it scales the front image about that much bigger than the images on either side.  So my example has 0.4, the front image will be 100% for a nice clear image, and to the left and right the images are about 60%, and everything on the way back is scaled down to the farScale value as normal.  I use 20% for farScale, and I like to set the yRadius a bit smaller for a little overlap.\r\nThe scale variable stays the same so rotation positions don't get messed up, and scaleonly stays between 0-1 so it doesn't go crazy.  It just makes that little curved bump at Pi/2 so the front image is how much bigger you want it."}}