OpenStructure
gradient.py

Draw a set of lines and color them using a gradient

1 lines=gfx.PrimList("lines")
2 
3 g=gfx.Gradient()
4 g.SetColorAt(0, gfx.Color(1.0, 0.0, 0.0, 1.0))
5 g.SetColorAt(0.5, gfx.Color(0.0, 1.0, 0.0, 1.0))
6 g.SetColorAt(1.0, gfx.Color(0.0, 0.0, 1.0, 1.0))
7 
8 for i in range(1000):
9  c=g.GetColorAt(0.001*i)
10  lines.AddLine(geom.Vec3(i*0.05, 0.0, -1), geom.Vec3(i*0.05, 0.0, 1), c)
11 
12 scene.Add(lines)
13 scene.center=geom.Vec3(25, 0, 0)
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48