lights()#

Sets the default ambient light, directional light, falloff, and specular values.

Examples#

example picture for lights()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    py5.background(0)
 4    py5.no_stroke()
 5    # sets the default ambient
 6    # and directional light
 7    py5.lights()
 8    py5.translate(20, 50, 0)
 9    py5.sphere(30)
10    py5.translate(60, 0, 0)
11    py5.sphere(30)
example picture for lights()
 1def setup():
 2    py5.size(100, 100, py5.P3D)
 3    py5.background(0)
 4    py5.no_stroke()
 5
 6
 7def draw():
 8    # include lights() at the beginning
 9    # of draw() to keep them persistent
10    py5.lights()
11    py5.translate(20, 50, 0)
12    py5.sphere(30)
13    py5.translate(60, 0, 0)
14    py5.sphere(30)

Description#

Sets the default ambient light, directional light, falloff, and specular values. The defaults are ambientLight(128, 128, 128) and directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and lightSpecular(0, 0, 0). Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop.

Underlying Processing method: lights

Syntax#

lights() -> None

Updated on November 12, 2021 11:30:58am UTC