The t
inside Animate[Plot3D[ww2, {x, 0, 1}, {y, 0, 1}], {t, 0, 0.6}]
is "localized," which means it is different than the t
that shows up when ww2
is evaluated. Animate[]
will replace all literally-occurring instances of the symbol t
with the localized variable; however, Plot3D[ww2, {x, 0, 1}, {y, 0, 1}]
contains no t
. Yes, as I implied, the value of ww2
contains a t
, but ww2
unevaluated is just the symbol ww2
: no t
. So when Animate[]
sets the value of the local t
, it does not affect the value of ww2
.
Animate[]
does this so that the value of t
outside the animation is not changed. This is important because when Animate[]
changes the value t
inside the animation, the change triggers a Dynamic[]
-related update that redraws the plot. If you change the value of (global) t
outside the animation, it won't affect the animation because it's a different t
; and likewise, the changes Animate[]
makes do not affect any calculations while the animation is running.
To get it to work you can use @Gianluca's With[]
code. Or you could do this:
ww2[t_] = ww[x, y, t] /. ParameterValues;
Animate[Plot3D[ww2[t], {x, 0, 1}, {y, 0, 1},
PlotRange -> {-0.0002, 0.0002}], {t, 0, 0.6},
AnimationRunning -> False]
Or this:
Animate[Plot3D[ww[x, y, t] /. ParameterValues, {x, 0, 1}, {y, 0, 1},
PlotRange -> {-0.0002, 0.0002}], {t, 0, 0.6},
AnimationRunning -> False]
There's also an option, LocalizeVariables -> False
, you could use, but many avoid that for the reasons given in my second paragraph: It makes the animation interact (unpredictably) with any calculation that is using the variable t
at the same time.