修訂 | bd8fc014e2e9126789abf0ab52c83b978a33d07c (tree) |
---|---|
時間 | 2021-09-17 23:25:23 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
A simple python code to produce an animation.
@@ -0,0 +1,15 @@ | ||
1 | +#! /usr/bin/env python3 | |
2 | + | |
3 | +import numpy as np | |
4 | +from mayavi import mlab | |
5 | +x, y = np.mgrid[0:3:1,0:3:1] | |
6 | +s = mlab.surf(x, y, np.asarray(x*0.1, 'd')) | |
7 | + | |
8 | +@mlab.animate | |
9 | +def anim(): | |
10 | + for i in range(10): | |
11 | + s.mlab_source.scalars = np.asarray(x*0.1*(i+1), 'd') | |
12 | + yield | |
13 | + | |
14 | +anim() | |
15 | +mlab.show() |