{"id":41456,"date":"2018-10-24T03:01:06","date_gmt":"2018-10-23T17:01:06","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=41456"},"modified":"2018-10-23T10:28:16","modified_gmt":"2018-10-23T00:28:16","slug":"animation-via-requestanimationframe-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/animation-via-requestanimationframe-primer-tutorial\/","title":{"rendered":"Animation via RequestAnimationFrame Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/raf.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Animation via RequestAnimationFrame Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/raf.jpg\" title=\"Animation via RequestAnimationFrame Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Animation via RequestAnimationFrame Primer Tutorial<\/p><\/div>\n<p>Have you set up some animation using the Javascript setTimeout and\/or setInterval timer functions, and found yourself disappointed with a lack of smoothness of animation?  You are not alone.<\/p>\n<p>Have you tried (the good advice of) <a target=_blank title='requestAnimationFrame information ... thanks' href='https:\/\/www.paulirish.com\/2011\/requestanimationframe-for-smart-animating\/'>requestAnimationFrame<\/a> event logic in Javascript?  We&#8217;ve pieced together a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/raf.html_GETME\" title=\"raf.html\">raf.html<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/raf.html\" title=\"Click picture\">proof of concept<\/a> that &#8220;colours in&#8221; the background of an initially white (with some headings and a colour picker in foreground) webpage.<\/p>\n<p>Hopefully this uses a smoother means of animation on your web browser too?!<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d41456' onclick='var dv=document.getElementById(\"d41456\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/animation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d41456' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Have you set up some animation using the Javascript setTimeout and\/or setInterval timer functions, and found yourself disappointed with a lack of smoothness of animation? You are not alone. Have you tried (the good advice of) requestAnimationFrame event logic in &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/animation-via-requestanimationframe-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,12,14,37],"tags":[84,2720,400,576,652,997,2719,1125,1126,1319],"class_list":["post-41456","post","type-post","status-publish","format-standard","hentry","category-animation","category-elearning","category-event-driven-programming","category-tutorials","tag-animation-2","tag-backgrout","tag-event","tag-html","tag-javascript","tag-programming","tag-requestanimationframe","tag-setinterval","tag-settimeout","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41456"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=41456"}],"version-history":[{"count":1,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41456\/revisions"}],"predecessor-version":[{"id":41457,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/41456\/revisions\/41457"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=41456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=41456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=41456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}