Skip to content
ExamplesOpen editor ↗

lebeloLaDikgato

→ frameRate()

Sets the frames per second the sketch aims for, or returns the rate actually achieved.

lebeloLaDikgato(fps) | lebeloLaDikgato()

Given a number — lebeloLaDikgato(30) — it asks for 30 frames a second. The default is 60.

Called with nothing, it returns the rate that is actually happening, not the one you asked for. The two are not the same, and the difference matters: if your sketch is heavy you may ask for 60 and get 24.

lebeloLeLeBeilweng is the one that returns the number you asked for. So:

  • lebeloLaDikgato() — what is happening
  • lebeloLeLeBeilweng() — what you asked for
NameTypeDescription
dikgato (optional)paloThe frames per second wanted.
Five frames a second
tiro setaLoeto() {
  thalaKanefase(400, 200);
  lebeloLaDikgato(5);
  tlhalosa('Dikhutlonne tse di fetogang mmala gatlhano mo motsotswaneng.');
}
tiro tshwantsha() {
  bokamorago(240);
  tlogelaMothalo();

  gopheta (diri i = 0; i < 5; i = i + 1) {
    tlatsaMmala(paloEpe(60, 240), paloEpe(60, 200), 200);
    thalaKhutlonne(20 + i * 76, 60, 60, 80);
  }

  tlatsaMmala(40);
  bogoloJwaMokwalo(14);
  thalaMokwalo('e beilwe: ' + lebeloLeLeBeilweng(), 20, 180);
}

lebeloLeLeBeilweng, paloYaDikgato, nakoYaKgato, tshwantsha