mirror of
https://github.com/anatolykopyl/vue-three-d-mockup.git
synced 2026-03-26 04:45:09 +00:00
Added a prop to control the phones color
This commit is contained in:
@@ -46,3 +46,4 @@ export default {
|
|||||||
### props:
|
### props:
|
||||||
- `screenImg`: path to image that will be displayed on the phones screen
|
- `screenImg`: path to image that will be displayed on the phones screen
|
||||||
- `lightClr`: color of the light in the environment
|
- `lightClr`: color of the light in the environment
|
||||||
|
- `phoneClr`: color of the phone
|
||||||
|
|||||||
@@ -116,7 +116,11 @@ var script = {
|
|||||||
},
|
},
|
||||||
lightClr: {
|
lightClr: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'hsl(0, 100%, 100%)',
|
default: 'white',
|
||||||
|
},
|
||||||
|
phoneClr: {
|
||||||
|
type: String,
|
||||||
|
default: 'white',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
@@ -207,7 +211,7 @@ var script = {
|
|||||||
(body) => {
|
(body) => {
|
||||||
body.traverse((child) => {
|
body.traverse((child) => {
|
||||||
if (child instanceof THREE.Mesh) {
|
if (child instanceof THREE.Mesh) {
|
||||||
child.material = new THREE.MeshLambertMaterial();
|
child.material = new THREE.MeshLambertMaterial({ color: props.phoneClr });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,11 @@ export default {
|
|||||||
},
|
},
|
||||||
lightClr: {
|
lightClr: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'hsl(0, 100%, 100%)',
|
default: 'white',
|
||||||
|
},
|
||||||
|
phoneClr: {
|
||||||
|
type: String,
|
||||||
|
default: 'white',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
@@ -115,7 +119,7 @@ export default {
|
|||||||
(body) => {
|
(body) => {
|
||||||
body.traverse((child) => {
|
body.traverse((child) => {
|
||||||
if (child instanceof THREE.Mesh) {
|
if (child instanceof THREE.Mesh) {
|
||||||
child.material = new THREE.MeshLambertMaterial();
|
child.material = new THREE.MeshLambertMaterial({ color: props.phoneClr });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user