{"id":24460,"date":"2022-06-15T21:11:57","date_gmt":"2022-06-16T02:11:57","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=24460"},"modified":"2022-06-16T07:34:29","modified_gmt":"2022-06-16T12:34:29","slug":"widget-wednesdays-24","status":"publish","type":"post","link":"https:\/\/blog.kenperlin.com\/?p=24460","title":{"rendered":"Widget Wednesdays #24"},"content":{"rendered":"<p>This week&#8217;s widget is, as suggested in an earlier post, a result of exploring the attic. Years ago I posted a simple program that uses an iterative loop to create a huge number of lovely looking patterns.<\/p>\n<p>Unfortunately that code was written in Java, so it no longer runs on the Web. So this evening I reimplemented it in Javascript. It lives again!<\/p>\n<p>As you move your mouse around, vast numbers of patterns are displayed. Some mouse positions produce beautifully symmetric results, others just result in a mess.<\/p>\n<p>The core code is two lines that look something like the following, which get repeated 8000 times to make the point (x,y) trace out a pattern. The loop starts with x=y=t=0, and (X,Y) is your cursor position:<\/p>\n<blockquote>\n<pre>t += ( pow(x*x*Y, X) + pow(y*y\/Y, Y) ) \/ 200;\nlineTo(x += cos(t), y += sin(t));\n<\/pre>\n<\/blockquote>\n<p>I love the emergent nature of it all &#8212; how a multitude of patterns can arise from something so simple.<\/p>\n<p>You can try it out <a href=\"http:\/\/kenperlin.com\/loops\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week&#8217;s widget is, as suggested in an earlier post, a result of exploring the attic. Years ago I posted a simple program that uses an iterative loop to create a huge number of lovely looking patterns. Unfortunately that code was written in Java, so it no longer runs on the Web. So this evening &hellip; <a href=\"https:\/\/blog.kenperlin.com\/?p=24460\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Widget Wednesdays #24&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24460"}],"collection":[{"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24460"}],"version-history":[{"count":4,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24460\/revisions"}],"predecessor-version":[{"id":24464,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24460\/revisions\/24464"}],"wp:attachment":[{"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}