1. Home
  2. /
  3. Babylonjs
  4. /
  5. Babylon.js Light Rotation

Babylon.js Light Rotation - Babylonjs Typing CST Test

Loading…

Babylon.js Light Rotation — Babylonjs Code

Rotates a light around a static cube.

# babylonjs/demo/light_rotate.js
const canvas = document.getElementById('renderCanvas');
const engine = new BABYLON.Engine(canvas, true);
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.ArcRotateCamera('camera', Math.PI/2, Math.PI/4, 6, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
const light = new BABYLON.PointLight('light', new BABYLON.Vector3(0, 5, 0), scene);
const box = BABYLON.MeshBuilder.CreateBox('box', {}, scene);
scene.registerBeforeRender(() => { light.position.x = Math.sin(Date.now() * 0.001) * 5; light.position.z = Math.cos(Date.now() * 0.001) * 5; });
engine.runRenderLoop(() => { scene.render(); });

Babylonjs Language Guide

Babylon.js is a powerful, open-source 3D engine for the web that enables developers to build immersive 3D games, simulations, visualizations, and XR experiences directly in the browser using WebGL, WebGPU, or WebXR.

Primary Use Cases

  • ▸3D games and interactive worlds
  • ▸Architectural visualization and digital twins
  • ▸AR/VR/XR immersive experiences
  • ▸Scientific and engineering simulations
  • ▸Product configurators and 3D e-commerce

Notable Features

  • ▸WebGL + WebGPU rendering
  • ▸WebXR full VR/AR support
  • ▸Powerful scene graph system
  • ▸Advanced PBR material system
  • ▸Node-based material and shader editor

Origin & Creator

Babylon.js was created by David Catuhe and the Microsoft Babylon team in 2013, with contributions from a large open-source community.

Industrial Note

Babylon.js is frequently used in aerospace simulations, product configurators, architectural walkthroughs, XR training, and high-fidelity 3D commerce applications.

More Babylonjs Typing Exercises

Simple Babylon.js SceneBabylon.js Spinning SphereBabylon.js Ground PlaneBabylon.js Colorful MaterialsBabylon.js Orbiting CameraBabylon.js Multiple MeshesBabylon.js Animated SphereBabylon.js Textured Cube

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher