[英]Javascript 3D Effect using three.js
This is my second time using three.js and I've been playing around for at least 3 hours. 这是我第二次使用three.js,并且已经玩了至少3个小时。 I cannot seem to find a direction.
我似乎找不到方向。
What I should build is something like this: https://www.g-star.com/nl_nl/newdenimarrivals 我应该构建的是这样的: https : //www.g-star.com/nl_nl/newdenimarrivals
I created the scene and everything, but I cannot seem to find a formula or anything on how to arrange the products like that (not to mention that I have to handle click events afterwards and move the camera to that product). 我创建了场景和所有内容,但是似乎找不到关于如何布置此类产品的公式或任何内容(更不用说我必须随后处理点击事件并将相机移至该产品)。
Do you guys have any leads or anything? 你们有线索还是什么?
EDIT: 编辑:
This is how I try to arrange the products. 这就是我尝试安排产品的方式。
arrangeProducts: function () {
var self = this;
this.products.forEach(function (element, index) {
THREE.ImageUtils.crossOrigin = '';
element.image = 'http://i.imgur.com/CSyFaYS.jpg';
//texture
var texture = THREE.ImageUtils.loadTexture(element.image, null);
texture.magFilter = THREE.LinearMipMapLinearFilter;
texture.minFilter = THREE.LinearMipMapLinearFilter;
//material
var material = new THREE.MeshBasicMaterial({
map: texture
});
//plane geometry
var geometry = new THREE.PlaneGeometry(element.width, element.height);
//plane
var plane = new THREE.Mesh(geometry, material);
plane.overdraw = true;
//set the random locations
/*plane.position.x = Math.random() * (self.container.width - element.width);
plane.position.y = Math.random() * (self.container.height - element.height);*/
plane.position.z = -2500 + (Math.random() * 50) * 50;
plane.position.x = Math.random() * self.container.width - self.container.width / 2;
plane.position.y = Math.random() * 200 - 100;
//add the plane to the scene
self.scene.add(plane);
});
},
EDIT 2: 编辑2:
I figured out: I need to add about 5 transparent concentric cilinders and put the products on each (random location) and have the camera in the center of all the cilinders and just rotate. 我计算出:我需要添加约5个透明同心镜,并将产品放在每个(随机位置)上,并将相机置于所有镜心的中心,然后旋转。 Buut, how do I put the images on the cilinider randomly?
Buut,如何将图像随机放置在cilinider上? I really have a blockout on that
我真的有一个障碍
On the three.js website you find a whole bunch of examples that can show you what is possible and how to do it. 在three.js网站上,您可以找到大量的示例 ,这些示例可以向您展示什么是可能的以及如何实现。 Don't expect to be an expert in only 3 hours.
不要指望仅3个小时就能成为专家。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.