Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mgasner committed Dec 2, 2017
1 parent 1b3c90e commit 8c4a802
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,33 @@ <h2>1f574, LLC</h2>
</div>
<script type="text/javascript">

var canvas;
var context;
var proton;
var renderer;
var emitter;
var stats;
const canvas = document.getElementById("canvas");
const context = canvas.getContext('2d');
var proton,
renderer,
emitter;

setTimeout(activate, 2000);

function resizeCanvas(){
const canvas = document.getElementById("canvas");
if (canvas.width < window.innerWidth)
{
canvas.width = window.innerWidth;
if (canvas.width < window.innerWidth) {
canvas.width = window.innerWidth;
}

if (canvas.height < window.innerHeight)
{
canvas.height = window.innerHeight;
if (canvas.height < window.innerHeight) {
canvas.height = window.innerHeight;
}
if (emitter) {
const box = document.getElementById('maninbusinesssuitlevitating').getBoundingClientRect();
const box = document.getElementById(
'maninbusinesssuitlevitating').getBoundingClientRect();
emitter.p.x = box.left + box.width / 2;
emitter.p.y = box.top + box.height / 2;
}
}

function activate() {
canvas = document.getElementById("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
context = canvas.getContext('2d');
context.globalCompositeOperation = "lighter";
context.globalCompositeOperation = "lighten";
loadImage();
}

Expand All @@ -68,18 +62,29 @@ <h2>1f574, LLC</h2>
function createProton(image) {
proton = new Proton;
emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(new Proton.Span(2, 10), new Proton.Span(2, 4));
emitter.rate = new Proton.Rate(
new Proton.Span(2, 10), new Proton.Span(2, 4));
emitter.addInitialize(new Proton.ImageTarget(image));
emitter.addInitialize(new Proton.Mass(new Proton.Span(1, 30)));
emitter.addInitialize(new Proton.Life(2, 6));
emitter.addInitialize(new Proton.V(new Proton.Span(0.5, 1.5), new Proton.Span(0, 360), 'polar'));
emitter.addBehaviour(new Proton.Alpha(1, [1, 1], Infinity, Proton.easeInSine));
emitter.addBehaviour(new Proton.Scale(new Proton.Span(1, 1.5), 0));
emitter.addBehaviour(new Proton.Color('random', 'random', Infinity, Proton.easeInSine));
const box = document.getElementById('maninbusinesssuitlevitating').getBoundingClientRect();
emitter.addInitialize(
new Proton.V(new Proton.Span(0.5, 1.5),
new Proton.Span(0, 360),
'polar'));
emitter.addBehaviour(
new Proton.Alpha(1, [1, 1], Infinity, Proton.easeInSine));
emitter.addBehaviour(
new Proton.Scale(new Proton.Span(1, 1.5), 0));
emitter.addBehaviour(
new Proton.Color(
'random', 'random', Infinity, Proton.easeInSine));
const box = document.getElementById(
'maninbusinesssuitlevitating').getBoundingClientRect();
emitter.p.x = box.left + box.width / 2;
emitter.p.y = box.top + box.height / 2;
emitter.addBehaviour(new Proton.Attraction(new Proton.Vector2D(emitter.p.x, emitter.p.y), 1));
emitter.addBehaviour(
new Proton.Attraction(
new Proton.Vector2D(emitter.p.x, emitter.p.y), 1));
emitter.emit();
proton.addEmitter(emitter);
renderer = new Proton.Renderer('canvas', proton, canvas);
Expand Down

0 comments on commit 8c4a802

Please sign in to comment.