From the course: Learning 3D Graphics on the Web with Three.js
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
SpotLight - JavaScript Tutorial
From the course: Learning 3D Graphics on the Web with Three.js
SpotLight
- [Instructor] In this video, we will take a look at SpotLights. You can create a SpotLight by simply calling the three SpotLight function. I will again create a dedicated function to wrap the three.js SpotLight functionality. So I will find the PointLight-creating function. I will copy it and paste it and change its name to getSpotLight. And here, instead of calling the PointLight function, I will call the SpotLight function. SpotLight works with the same arguments as the PointLight. So I will get this function's name. And inside my main function body, instead of creating a PointLight here, I'll be creating a SpotLight, and I will be changing the references to the PointLight name with the SpotLight name. I will be selecting all these references by pressing the Commands + D button on the Sublime Text editor. So, here, instead of calling these variables PointLights, I will be changing them to SpotLight. And one more change that I would like to do is I would like to start my SpotLight…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.