How rdkcentral/lightning works
Lightning is a portable, high-performance framework for building TV applications. The main workflow starts with an application receiving user input, managing a scene on a Stage, and rendering that scene through a graphics backend. The repository also exposes animation and transition timing, layout, textures and text/image handling, and reusable visual components and shaders. Source excerpts confirm application-to-stage construction, frame-driven animation managers, and texture-manager uploads; some Stage and renderer wiring is inferred from module responsibilities, so uncertain links are omitted.
Main entry points: Renderer.mjs Renderer · Application.mjs Application · Stage.mjs Stage · Element.mjs Scene elements
Components 17
Application
- Application
src/application/Application.mjs
Scene and motion
- Stage
src/tree/Stage.mjs - Scene elements
src/tree/Element.mjs - Flex layout
src/flex/layout/FlexLayout.mjs - Animations
src/animation/AnimationManager.mjs - Transitions
src/animation/TransitionManager.mjs
Content and assets
- Texture manager
src/tree/TextureManager.mjs - Texture types
src/textures - Text rendering
src/textures/TextTextureRenderer.ts - Image worker
src/platforms/browser/ImageWorker.mjs
Graphics
- Visual components
src/components - Renderer
src/renderer/Renderer.mjs - WebGL backend
src/renderer/webgl/WebGLRenderer.mjs - Canvas 2D backend
src/renderer/c2d/C2dRenderer.mjs - Shaders
src/renderer/webgl/shaders
Other components
- TV app user
- Browser platform
src/platforms/browser/WebPlatform.mjs
Connections 15
- TV app user → Application: provides input
- Application → Stage: creates
- Application → Scene elements: dispatches input
- Stage → Animations: emits frame start
- Stage → Transitions: emits frame start
- Scene elements → Flex layout: uses layout
- Texture manager → Texture types: creates sources
- Texture manager → Renderer: uploads textures
- Text rendering → Browser platform: uses browser APIs
- Image worker → Browser platform: uses worker APIs
- Renderer → WebGL backend: selects backend
- Renderer → Canvas 2D backend: selects backend
- WebGL backend → Shaders: runs shaders
- Renderer → Browser platform: renders to platform
- Visual components → Scene elements: extends scene