LogisticSegments[r_,x0_,its_]:=Module[
{l=NestList[r#(1-#)&,x0,its]},
Partition[Flatten[Transpose[{l,l}]],2,1]
]
p2=Partition[LogisticSegments[3.741,.00079,15],2,1]
movie=Table[Plot[{3.741x(1-x),x},{x,0,1},PlotStyle->{{},Dashing[{.02}]},
Prolog->MapIndexed[{Hue[#2[[1]]/Length[p2]],Line[#]}&,Take[p2,i]],
AspectRatio->Automatic,
AxesLabel->TraditionalForm/@{(Subscript[x, n]),(Subscript[x, n+1])}
],{i,Length[p2]}];
ListAnimate[movie]

Clear[g,a,b,p0]
g[x_]=Cos[x];
p0=0;
a=0;
b=1;
LogisticSegments[x0_,its_]:=Module[
{l=NestList[g[#]&,x0,its]},
Partition[Flatten[Transpose[{l,l}]],2,1]
]
p2=Partition[LogisticSegments[.00079,15],2,1];
movie=Table[Plot[{g[x],x},{x,0,1},PlotStyle->{{},Dashing[{.02}]},
Prolog->MapIndexed[{Hue[#2[[1]]/Length[p2]],Line[#]}&,Take[p2,i]],
AspectRatio->Automatic,
AxesLabel->TraditionalForm/@{(Subscript[x, n]),(Subscript[x, n+1])}
],{i,Length[p2]}];
ListAnimate[movie]