[From Gideros] Generate spinning rays dynamically

Thanks to everyone for the suggestions. I’m currently trying @Jerakin’s solution and it seems to work pretty well, the rays can be generated dynamically.

local function generate_rays(node_prot, n_rays, alpha)
	local rays_deg=360/(n_rays*2)

	gui.set_fill_angle(node_prot, rays_deg)
	gui.set_perimeter_vertices(node_prot, 4)

	local color=gui.get_color(node_prot)
	color.w=alpha
	gui.set_color(node_prot, color)

	for i=1,n_rays-1 do
		local node=gui.clone(node_prot)
		gui.set_rotation(node, vmath.vector3(0, 0, i*2*rays_deg))
	end
end

function init(self)
	generate_rays(gui.get_node("ray_prototype_0"), 12, 0.6)
	generate_rays(gui.get_node("ray_prototype_1"), 16, 0.2)

	local root=gui.get_node("root_0")
	gui.animate(root, gui.PROP_ROTATION, vmath.vector3(0, 0, -360), gui.EASING_LINEAR, 60, 0, nil, gui.PLAYBACK_LOOP_FORWARD) -- start animation

	local root=gui.get_node("root_1")
	gui.animate(root, gui.PROP_ROTATION, vmath.vector3(0, 0, 360), gui.EASING_LINEAR, 30, 0, nil, gui.PLAYBACK_LOOP_FORWARD) -- start animation
end

One problem that I’m currently facing is that (for what I understand) the GUIs are rendered in front of all the other elements. Following this thread I managed to make them render in the background, however now all the GUIs elements get drawn behind the other elements.

Is there a way to selectively render one GUI only in the background?