[英]Javascript 3D Effect using three.js
这是我第二次使用three.js,并且已经玩了至少3个小时。 我似乎找不到方向。
我应该构建的是这样的: https : //www.g-star.com/nl_nl/newdenimarrivals
我创建了场景和所有内容,但是似乎找不到关于如何布置此类产品的公式或任何内容(更不用说我必须随后处理点击事件并将相机移至该产品)。
你们有线索还是什么?
编辑:
这就是我尝试安排产品的方式。
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);
});
},
编辑2:
我计算出:我需要添加约5个透明同心镜,并将产品放在每个(随机位置)上,并将相机置于所有镜心的中心,然后旋转。 Buut,如何将图像随机放置在cilinider上? 我真的有一个障碍
在three.js网站上,您可以找到大量的示例 ,这些示例可以向您展示什么是可能的以及如何实现。 不要指望仅3个小时就能成为专家。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.