{"id":1695,"date":"2022-02-11T19:55:41","date_gmt":"2022-02-11T18:55:41","guid":{"rendered":"https:\/\/hannes.enjoys.it\/blog\/?p=1695"},"modified":"2022-02-11T19:55:59","modified_gmt":"2022-02-11T18:55:59","slug":"waggawaggawaggawagga-animated-ducks-in-qgis","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2022\/02\/waggawaggawaggawagga-animated-ducks-in-qgis\/","title":{"rendered":"Waggawaggawaggawagga animated ducks in QGIS"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video height=\"800\" style=\"aspect-ratio: 800 \/ 800;\" width=\"800\" controls src=\"https:\/\/hannes.enjoys.it\/blog\/wp-content\/uploads\/x11grab_edit.mp4\"><\/video><\/figure>\n\n\n\n<p>I used ne_110m_admin_0_countries.<\/p>\n\n\n\n<p>Rendering updates for the layer at 0.1 seconds.<\/p>\n\n\n\n<p>Geometry Generator for a Point for the marker location via <strong><code>line_interpolate_point<\/code><\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>with_variable(\n  'biggest_geom',\n  geometry_n(order_parts($geometry, 'area($geometry)', ascending:=False), 1),\n  line_interpolate_point(\n    boundary(@biggest_geom), \n    perimeter(@biggest_geom)*(round(epoch(now())\/100)%100\/100)\n  )\n)<\/code><\/pre>\n\n\n\n<p>Raster Image Marker with https:\/\/opengameart.org\/content\/character-spritesheet-duck, vertical anchor at bottom, sprite choice between walking and running (doesn&#8217;t actually work) plus the frame via<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>with_variable(\n  'biggest_geom',\n  geometry_n(order_parts($geometry, 'area($geometry)', ascending:=False), 1),\n  '\/your\/path\/Duck\/Sprites\/Walking-Running\/'\n  || if(perimeter(@biggest_geom) &lt; 10, 'Walking', 'Running')\n  || ' 00'\n  || to_string(round(epoch(now())\/200)%2+1)\n  || '.png'\n)<\/code><\/pre>\n\n\n\n<p>Rotation did not work, I tried <code><strong>line_interpolate_angle<\/strong><\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>with_variable(\n  'biggest_geom',\n  geometry_n(order_parts($geometry, 'area($geometry)', ascending:=False), 1),\n  line_interpolate_angle(\n    boundary(@biggest_geom), \n    perimeter(@biggest_geom)*(round(epoch(now())\/100)%100\/100)\n  )\n)<\/code><\/pre>\n\n\n\n<p>Steps via two more Geometry Generators, both for Lines using <strong><code>line_substring<\/code><\/strong> and some nice style (inspired by the wonderful built-in <em>cat trail<\/em> preset):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>with_variable(\n\t'biggest_geom',\n\tgeometry_n(order_parts($geometry, 'area($geometry)', ascending:=False), 1),\n  \tline_substring(\n\t  boundary(@biggest_geom), \n\t  0,\n\t  perimeter(@biggest_geom)*(round(epoch(now())\/100)%100\/100)\n\t)\n)<\/code><\/pre>\n\n\n\n<p>Could be improved if (for example) Raster Image Marker would support:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Choice of resampling algorithm<\/li><li>Flipping<\/li><li>Rotation would work, no idea what&#8217;s wrong with my expression, it works with random values, so &#8230;<\/li><li>Whatever is broken with the choice between &#8216;Walking&#8217; and &#8216;Running&#8217; in the file path expression<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I used ne_110m_admin_0_countries. Rendering updates for the layer at 0.1 seconds. Geometry Generator for a Point for the marker location via line_interpolate_point: Raster Image Marker with https:\/\/opengameart.org\/content\/character-spritesheet-duck, vertical anchor at bottom, sprite choice between walking and running (doesn&#8217;t actually work) plus the frame via Rotation did not work, I tried line_interpolate_angle: Steps via two more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,29,3,2,31,40],"tags":[],"class_list":["post-1695","post","type-post","status-publish","format-standard","hentry","category-cartography","category-gis","category-guide","category-map","category-qgis","category-small-things"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=1695"}],"version-history":[{"count":3,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1695\/revisions"}],"predecessor-version":[{"id":1699,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/1695\/revisions\/1699"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=1695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=1695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=1695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}