# Is there a way to switch planet textures with a button click?

**URL:** <https://discourse.threejs.org/t/is-there-a-way-to-switch-planet-textures-with-a-button-click/3563>\
**Category:** Questions\
**Tags:** textures, animation\
**Created:** [July 27, 2018, 7:39am UTC](https://discourse.threejs.org/t/is-there-a-way-to-switch-planet-textures-with-a-button-click/3563 "2018-07-27T07:39:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SCDavison](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SCDavison](https://discourse.threejs.org/u/SCDavison)\
**Post date:** [July 27, 2018, 7:39am UTC](https://discourse.threejs.org/t/is-there-a-way-to-switch-planet-textures-with-a-button-click/3563/1 "2018-07-27T07:39:24Z")

</div>

Hey, This is my fist post here, so please forgive me if I am asking too many questions. I am VERY new to three.js, and WebGL as a whole. Actually, I’m kinda new to JavaScript… there I said it.

But I am trying to put together a small project of planets. I ran across the discussion found here and it is almost exactly what I have been looking for.

> [@Threejs 3d earth + marker needs to be clickable](https://discourse.threejs.org/t/threejs-3d-earth-marker-needs-to-be-clickable/3118):
>
> here my project [https://jsfiddle.net/rsks86/xg1o4ekr/372/](https://jsfiddle.net/rsks86/xg1o4ekr/372/) i tried everything to make the marker clickable but did’t work … anyone can help pleace

I made a few edits to remove things that I don’t need/want, and have this (hopefully that fiddle shows up):

> **[Edit fiddle - JSFiddle - Code Playground](https://jsfiddle.net/Lj5thcqs/2/)**
>
> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.

The first things I’d like to do is remove that loading screen, as well as the black background.  
Then I want to be able to show the planet in a div/container so that I can add a different CSS background.

The last thing I’d like help on is that I will have a list of planets. I want to be able to click on a planet name and have the planet texture change based on whatever name is clicked.  
What I have in mind is VERY close to what has been done here:  
[http://jeromeetienne.github.io/threex.planets/examples/select.html#Earth](http://jeromeetienne.github.io/threex.planets/examples/select.html#Earth)  
and

> <https://github.com/jeromeetienne/threex.planets/blob/master/examples/select.html>

But I’m hoping there is a less verbose way of switching the planet textures in JS than using the else if statements.

I know I’m asking a lot, but I appreciate any and all help you all can provide.

Thanks.

---

<div class="post-metadata">

**Author:** ![trymoremore](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/trymoremore/32/1855_2.png) [@trymoremore](https://discourse.threejs.org/u/trymoremore)\
**Post date:** [July 27, 2018, 7:51am UTC](https://discourse.threejs.org/t/is-there-a-way-to-switch-planet-textures-with-a-button-click/3563/2 "2018-07-27T07:51:35Z")

</div>

you can switch the planet through modify the material of planet
