forked from jsoverson/JavaScript-Particle-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (29 loc) · 891 Bytes
/
Copy pathmain.js
File metadata and controls
38 lines (29 loc) · 891 Bytes
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
/*global require, dat*/
require.config({
deps : ['vendor/Events', 'vendor/lodash','vendor/dat.gui.min']
});
require(
[
'lib/ParticleSystem',
'lib/Display',
'lib/Vector',
'gui'
],
function(ParticleSystem, Display, Vector, GUI){
"use strict";
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
window.addEventListener('resize', resize); resize();
var display = new Display(document.getElementById('canvas'));
display.init();
var particleSystem = new ParticleSystem().init(display);
display.start();
var gui = new GUI(particleSystem, display);
particleSystem.addEmitter(new Vector(360,230),Vector.fromAngle(0,2));
particleSystem.addField(new Vector(700,230), -140);
function resize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
}
);