[][src]Static p5_sys::global::directionalLight

pub static directionalLight: DirectionalLightInternalType

Creates a directional light with a color and a direction

A maximum of 5 directionalLight can be active at one time

Examples

function setup() {
  createCanvas(100, 100, WEBGL);
}
function draw() {
  background(0);
  //move your mouse to change light direction
  let dirX = (mouseX / width - 0.5) * 2;
  let dirY = (mouseY / height - 0.5) * 2;
  directionalLight(250, 250, 250, -dirX, -dirY, -1);
  noStroke();
  sphere(40);
}

Overloads

v1 red or hue value (depending on the current color mode),

v2 green or saturation value

v3 blue or brightness value

position the direction of the light


color color Array, CSS color string, or p5.Color value

x x axis direction

y y axis direction

z z axis direction


color color Array, CSS color string, or p5.Color value

position the direction of the light


v1 red or hue value (depending on the current color mode),

v2 green or saturation value

v3 blue or brightness value

x x axis direction

y y axis direction

z z axis direction