Static p5_sys::global::pointLight[][src]

pub static pointLight: PointLightInternalType
Expand description

Creates a point light with a color and a light position

A maximum of 5 pointLight can be active at one time

Examples

function setup() {
  createCanvas(100, 100, WEBGL);
}
function draw() {
  background(0);
  //move your mouse to change light position
  let locX = mouseX - width / 2;
  let locY = mouseY - height / 2;
  // to set the light position,
  // think of the world's coordinate as:
  // -width/2,-height/2 -------- width/2,-height/2
  //                |            |
  //                |     0,0    |
  //                |            |
  // -width/2,height/2--------width/2,height/2
  pointLight(250, 250, 250, locX, locY, 50);
  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

x x axis position

y y axis position

z z axis position


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

v2 green or saturation value

v3 blue or brightness value

position the position of the light


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

x x axis position

y y axis position

z z axis position


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

position the position of the light