Reworked Breathing
It now no longer feels like breathing. It should feel a bit more amorphis and subtle.
This commit is contained in:
parent
1f29626bba
commit
d2a6666b9b
|
@ -20,17 +20,16 @@ Engine.Point = function(id, x, y, shapeSize){
|
||||||
this.accel = Vector.coerce(this.accel);
|
this.accel = Vector.coerce(this.accel);
|
||||||
this.vel = Vector.coerce(this.vel);
|
this.vel = Vector.coerce(this.vel);
|
||||||
|
|
||||||
this.stiffness = Engine.getRandomFloat(3, 6);
|
this.stiffness = Engine.getRandomFloat(150, 600);
|
||||||
this.friction = Engine.getRandomFloat(0.15, 0.3);
|
this.friction = Engine.getRandomFloat(12, 18);
|
||||||
};
|
};
|
||||||
|
|
||||||
Engine.Point.prototype = {
|
Engine.Point.prototype = {
|
||||||
|
|
||||||
radius: 1,
|
radius: 1,
|
||||||
|
|
||||||
stiffness : 0.5,
|
stiffness : 200,
|
||||||
// friction : 0.00001,
|
friction : 13,
|
||||||
friction : 0.01,
|
|
||||||
threshold : 0.03,
|
threshold : 0.03,
|
||||||
|
|
||||||
pos: {
|
pos: {
|
||||||
|
@ -59,8 +58,8 @@ Engine.Point.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateBreathingPhysics: function(){
|
updateBreathingPhysics: function(){
|
||||||
this.stiffness = 0.1;
|
this.stiffness = Engine.getRandomFloat(2, 4);
|
||||||
this.friction = 0.05;
|
this.friction = Engine.getRandomFloat(1, 2);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTarget: function(newSize){
|
updateTarget: function(newSize){
|
||||||
|
@ -74,8 +73,8 @@ Engine.Point.prototype = {
|
||||||
this.target.sub(diff);
|
this.target.sub(diff);
|
||||||
|
|
||||||
this.target.add({
|
this.target.add({
|
||||||
x: Engine.getRandomFloat(-8, 8),
|
x: Engine.getRandomFloat(-3, 3),
|
||||||
y: Engine.getRandomFloat(-8, 8)
|
y: Engine.getRandomFloat(-3, 3)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ Engine.Point.prototype = {
|
||||||
|
|
||||||
this.accel.set(newAccel);
|
this.accel.set(newAccel);
|
||||||
|
|
||||||
this.vel.add(this.accel);
|
this.vel.add(Vector.mult(this.accel, engine.tick));
|
||||||
|
|
||||||
this.pos.add(
|
this.pos.add(
|
||||||
Vector.mult(this.vel, engine.tick)
|
Vector.mult(this.vel, engine.tick)
|
||||||
|
|
|
@ -81,13 +81,7 @@ Engine.Shape.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.breatheIn) {
|
|
||||||
scale = 1;
|
scale = 1;
|
||||||
} else {
|
|
||||||
scale = 1.05;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breatheIn = !this.breatheIn;
|
|
||||||
|
|
||||||
newSize = Vector.mult(this.sizeRef, scale);
|
newSize = Vector.mult(this.sizeRef, scale);
|
||||||
|
|
||||||
|
@ -127,16 +121,16 @@ Engine.Shape.prototype = {
|
||||||
poly = this.polygons[p];
|
poly = this.polygons[p];
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(
|
ctx.moveTo(
|
||||||
poly.a.pos.x * scale >> 0,
|
poly.a.pos.x * scale,
|
||||||
poly.a.pos.y * scale >> 0
|
poly.a.pos.y * scale
|
||||||
);
|
);
|
||||||
ctx.lineTo(
|
ctx.lineTo(
|
||||||
poly.b.pos.x * scale >> 0,
|
poly.b.pos.x * scale,
|
||||||
poly.b.pos.y * scale >> 0
|
poly.b.pos.y * scale
|
||||||
);
|
);
|
||||||
ctx.lineTo(
|
ctx.lineTo(
|
||||||
poly.c.pos.x * scale >> 0,
|
poly.c.pos.x * scale,
|
||||||
poly.c.pos.y * scale >> 0
|
poly.c.pos.y * scale
|
||||||
);
|
);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
ctx.fillStyle = poly.fillStyle;
|
ctx.fillStyle = poly.fillStyle;
|
||||||
|
|
|
@ -73,7 +73,7 @@ Engine = Base.extend({
|
||||||
.then(function(){
|
.then(function(){
|
||||||
this.starGeneratorRate = 200;
|
this.starGeneratorRate = 200;
|
||||||
}, this)
|
}, this)
|
||||||
.wait(2000)
|
.wait(500)
|
||||||
.then(function(){
|
.then(function(){
|
||||||
parent.className += ' state-one';
|
parent.className += ' state-one';
|
||||||
})
|
})
|
||||||
|
@ -93,10 +93,13 @@ Engine = Base.extend({
|
||||||
.then(function(){
|
.then(function(){
|
||||||
this.showShapes = true;
|
this.showShapes = true;
|
||||||
}, this)
|
}, this)
|
||||||
.wait(1000)
|
.wait(800)
|
||||||
|
.then(function(){
|
||||||
|
this.logo.startBreathing();
|
||||||
|
}, this)
|
||||||
|
.wait(200)
|
||||||
.then(function(){
|
.then(function(){
|
||||||
this.showGrid = true;
|
this.showGrid = true;
|
||||||
// this.logo.startBreathing();
|
|
||||||
}, this)
|
}, this)
|
||||||
.wait(1000)
|
.wait(1000)
|
||||||
.then(function(){
|
.then(function(){
|
||||||
|
|
Loading…
Reference in New Issue