{"action":"created","issue":{"url":"https://api.github.com/repos/raphamorim/origami.js/issues/44","repository_url":"https://api.github.com/repos/raphamorim/origami.js","labels_url":"https://api.github.com/repos/raphamorim/origami.js/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/raphamorim/origami.js/issues/44/comments","events_url":"https://api.github.com/repos/raphamorim/origami.js/issues/44/events","html_url":"https://github.com/raphamorim/origami.js/issues/44","id":184644289,"number":44,"title":"Sprite loop","user":{"login":"gpaixao","id":9096630,"avatar_url":"https://avatars.githubusercontent.com/u/9096630?v=3","gravatar_id":"","url":"https://api.github.com/users/gpaixao","html_url":"https://github.com/gpaixao","followers_url":"https://api.github.com/users/gpaixao/followers","following_url":"https://api.github.com/users/gpaixao/following{/other_user}","gists_url":"https://api.github.com/users/gpaixao/gists{/gist_id}","starred_url":"https://api.github.com/users/gpaixao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpaixao/subscriptions","organizations_url":"https://api.github.com/users/gpaixao/orgs","repos_url":"https://api.github.com/users/gpaixao/repos","events_url":"https://api.github.com/users/gpaixao/events{/privacy}","received_events_url":"https://api.github.com/users/gpaixao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-22T17:53:15Z","updated_at":"2016-10-23T17:12:57Z","closed_at":null,"body":"I'm using `origami.js` for create a sample game, and I need my sprite in animation loop.\r\nI saw the source code and understand that your first condition is if the sprite stay outside of canvas and after if the `loop` is false.\r\n\r\n```js\r\nfunction drawSprite(sprite) {\r\n  var self = this;\r\n\r\n  if (sprite.posX === sprite.widthTotal) {\r\n    if (sprite.loop === false) {\r\n      window.cancelAnimationFrame(sprite.animation);\r\n      return;\r\n    }\r\n    sprite.posX = 0;\r\n  }\r\n\r\n...\r\n```\r\n\r\nI think that logic is:\r\n\r\n```js\r\nfunction drawSprite(sprite) {\r\n  var self = this;\r\n\r\n  if (sprite.loop === false) {\r\n      window.cancelAnimationFrame(sprite.animation);\r\n      return;\r\n    }\r\n\r\n  if (sprite.posX === sprite.widthTotal ) {\r\n    sprite.posX = 0;\r\n  }\r\n\r\n...\r\n```\r\n\r\nIf I want create a true loop, where my sprite forever animate.\r\n\r\nThe `origami.js`just execue one time the animation and not work like a loop.\r\n\r\n*Example:*\r\n\r\n![example .gif](https://cms-assets.tutsplus.com/uploads/users/358/posts/25363/image/00-final-product-final.gif)"},"comment":{"url":"https://api.github.com/repos/raphamorim/origami.js/issues/comments/255600720","html_url":"https://github.com/raphamorim/origami.js/issues/44#issuecomment-255600720","issue_url":"https://api.github.com/repos/raphamorim/origami.js/issues/44","id":255600720,"user":{"login":"gpaixao","id":9096630,"avatar_url":"https://avatars.githubusercontent.com/u/9096630?v=3","gravatar_id":"","url":"https://api.github.com/users/gpaixao","html_url":"https://github.com/gpaixao","followers_url":"https://api.github.com/users/gpaixao/followers","following_url":"https://api.github.com/users/gpaixao/following{/other_user}","gists_url":"https://api.github.com/users/gpaixao/gists{/gist_id}","starred_url":"https://api.github.com/users/gpaixao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpaixao/subscriptions","organizations_url":"https://api.github.com/users/gpaixao/orgs","repos_url":"https://api.github.com/users/gpaixao/repos","events_url":"https://api.github.com/users/gpaixao/events{/privacy}","received_events_url":"https://api.github.com/users/gpaixao/received_events","type":"User","site_admin":false},"created_at":"2016-10-23T17:12:57Z","updated_at":"2016-10-23T17:12:57Z","body":"I've a question. \r\n\r\n```js\r\nOrigami.sprite = function(x, y, properties) {\r\n  var self = this;\r\n\r\n  if (!properties || !properties.src)\r\n    return this;\r\n\r\n  var image = new Image(),\r\n    frames = (properties.frames || 0), //here\r\n    loop = (properties.loop || true), //here\r\n    speed = (properties.speed || 10); //here\r\n```\r\n\r\nYou set `frames`, `loop` and `speed`, but where you use?"}}
{"actor":{"display_login":"gpaixao"}}