Consider a slightly modified version to the workaround to this question

```
sage: k = 5
sage: f = Piecewise([[(-2,1),k],[(1,4),x]])
sage: g = Piecewise([[(-2,1),1],[(1,4),2*x]])
sage: P = plot(f,color='green')
sage: Q = plot(g,linestyle='--')
sage: P+Q
```

Is it possible to animate this plot say with k ranging from 0 to 10?

I tried:

```
k = 5
f = Piecewise([[(-2,1),k],[(1,4),x]])
g = Piecewise([[(-2,1),1],[(1,4),2*x]])
P = plot(f,color='green')
Q = plot(g,linestyle='--')
X = P+Q
b = animate([X for k in srange(0,10)],xmin=0,xmax=4,figsize=[5,5])
b
b.show()
```

but it calculates for minutes and doesn't show up a result. (I tried examples from the documentation which worked fine).

I also tried this:

```
t = var('t')
k = var('k')
def f(t,k):
if t <=1:
return t
else:
return k
def g(t,k):
if t <=1:
return 1
else:
return 2*t
@interact
def _(k=(0,10)):
p1=plot(f(t,k),(t,0,3),ymax=10,ymin=0,color='green')
p2=plot(g(t,k),(t,0,3))
show(p1 + p2)
```

However the piecewise defined functions don't work in this case.