[][src]Static p5_sys::global::cos

pub static cos: CosInternalType

Calculates the cosine of an angle. This function takes into account the current angleMode. Values are returned in the range -1 to 1.

Examples

let a = 0.0;
let inc = TWO_PI / 25.0;
for (let i = 0; i < 25; i++) {
  line(i * 4, 50, i * 4, 50 + cos(a) * 40.0);
  a = a + inc;
}

Parameters

angle the angle