f[x_]=Piecewise[{{1+x,-1<x<0},{1-x,0<x<1}}]

Plot[f[x],{x,-4,4},PlotRange->All]

u1[x_,t_,c_]=f[x-c t]/2+f[x+c t]/2

Plot[u1[x,2,1],{x,-4,4},PlotRange->All]

Animate[Plot[u1[x,t,1],{x,-10,10},PlotRange->{0,1}],{t,0,10},AnimationRunning->False]

g[x_]=Piecewise[{{1+x,-1<x<0},{1-x,0<x<1}}]

u2[x_,t_,c_]=Integrate[g[y],{y,x-c t,x+c t}]/2c

Plot[u2[x,2,1],{x,-10,10},PlotRange->{0,1}]

Clear[u2]

u2[x_,t_,c_]:=NIntegrate[g[y],{y,x-c t,x+c t}]/2c

Plot[u2[x,2,1],{x,-10,10},PlotRange->{0,1}]

Animate[Plot[u2[x,t,1],{x,-10,10},PlotRange->{0,1}],{t,0,10},AnimationRunning->False]