QGIS Animation workbench walk through - Country guessing game
Channel: Kartoza
Date: 2022-06-04

This video is the technical notes on how I created this https://www.youtube.com/watch?v=HDPrpsDaxH4

Here are the different expressions I used:

Rule for rule based renderer: @hover_feature_id = $id

Assistant generated rule for gradient fill second colour: 

coalesce(ramp_color('custom ramp',scale_linear(@current_hover_frame, 0, 50, 0, 1)), '#000000')

Geometry generator for painting in the country boundaries:


-- This clips an increasingly longer piece out of the exterior ring
-- of the country so that we can animate the border drawing in.
 
with_variable('full_line', exterior_ring( $geometry ),
  line_substring( 
  @full_line,
  start_distance:=0.0,     
  end_distance:=(@current_hover_frame / @hover_frames) * length(@full_line)
 )
)

Expression for labels (replace gt with a greater than symbole below):

if(@hover_feature_id = $id AND @current_hover_frame gt 150, "NAME", NULL)

Expression for label sizes:

coalesce(scale_linear(@current_hover_frame, 150, 240, 10, 550), 0)


Find out more about the QGIS Animation Workbench here:

https://timlinux.github.io/QGISAnimationWorkbench/