admin管理员组文章数量:1312774
if (child.name === "Computer") {
child.children[1].material = new THREE.MeshBasicMaterial({
map: this.resources.items.screen,
});
}
For example in this scenario i need to add different screens on scroll of different sections of page
How to achieve it?
if (child.name === "Computer") {
child.children[1].material = new THREE.MeshBasicMaterial({
map: this.resources.items.screen,
});
}
For example in this scenario i need to add different screens on scroll of different sections of page
How to achieve it?
Share Improve this question edited Feb 1 at 17:47 James Z 12.3k10 gold badges27 silver badges47 bronze badges asked Feb 1 at 11:39 Yashraj TarteYashraj Tarte 311 bronze badge1 Answer
Reset to default 1You just have to update it once you change the map. It would be better if you create the material first, outside any function and surly out side the for loop, the apply it like:
const myMaterial = new THREE.MeshBasicMaterial({
map: this.resources.items.screen,
});
if (child.name === "Computer") {
child.children[1].material = myMaterial;
}
And once you update this.resources.items.screen
, you can do this:
myMaterial.needsUpdate = true;
Ref: https://threejs./docs/#api/en/materials/Material.needsUpdate
本文标签: javascriptHow to change the video on scroll according to sections of the pageStack Overflow
版权声明:本文标题:javascript - How to change the video on scroll according to sections of the page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741877183a2402533.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论