-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (38 loc) · 1.38 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(function(){
var _ = require('lodash'),
THREE = require('three');
var RenderPass = require('lumine').Passes.RenderPass;
var Layout = require('./layout');
module.exports = function(Scene, canvas, lumine, layer){
// Scene
var scene = new THREE.Scene();
// Camera
var camera = new THREE.OrthographicCamera(0, canvas.size.width, canvas.size.height, 0, 0, 9999 * 2);
camera.aspect = canvas.size.width / canvas.size.height;
camera.updateProjectionMatrix();
camera.position.z = 9999;
camera.lookAt(new THREE.Vector3(0, 0, 0));
// Layout
var scrollProxy = new ScrollProxy();
var layout = new Layout(lumine, canvas, scene, camera),
sizeNeedsUpdate = false;
layout.update(Scene._lumine_typeform_boxes, layer.modules);
// Listeners
canvas.on('resize', function(){
sizeNeedsUpdate = true;
});
canvas.on('render', function(delta){
if(sizeNeedsUpdate){
camera.right = canvas.size.width;
camera.top = canvas.size.height;
camera.aspect = canvas.size.width / canvas.size.height;
camera.updateProjectionMatrix();
layout.render(delta, true, Scene._lumine_typeform_boxes);
sizeNeedsUpdate = false;
}else{
layout.render(delta, false);
}
});
return new RenderPass(scene, camera, undefined, new THREE.Color(0xffffff), 1);
};
})();