Question: Can I plot a piecewise PDE solution with animation?

Hi, I have a 1D wave equation with a piecewise initial value, I am trying to plot the solution with animation, I use the below code, However, it does not give me the animation I want but give me some error, which I am not understande.

My code is following:

pde := diff(u(x, t), t $ 2) - diff(u(x, t), x $ 2) = 0

h := piecewise(-1 <= x and x <= 0, x + 2, 0 <= x and x <= 1, 2 - x, 0)

ic := u(x, 0) = h, D[2](u)(x, 0) = 0

sol := pdsolve([pde, ic])

plots[animate](plot, [sol, x = -10 .. 10], t = 0 .. 5)

and the result is showing as picture below

Please Wait...