Skip to content

Commit bf6dff9

Browse files
committed
fixed bug in clamp function / added better landing page
1 parent 24015a8 commit bf6dff9

18 files changed

+311
-99
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v1.2.1 - 11-07-2019
9+
10+
### Added
11+
12+
- better landing page
13+
- improved examples
14+
15+
### Fixed
16+
17+
- bug in clamp function
18+
819
## v1.2.0 - 08-07-2019
920

1021
### Added
22+
1123
- Hidden Sticks with hidden parameter to Stick class
1224
- Setters API for easy use of Point and Stick constructors
1325
- Method chaining for Point and Stick

dist/verly.bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/verly.bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/behavior.html

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -34,10 +32,13 @@
3432
window.onload = function () {
3533
let canvas = document.getElementById('c');
3634
let ctx = canvas.getContext('2d');
37-
let width = 600;
38-
let height = 500;
35+
let width = window.innerWidth;
36+
let height = window.innerHeight;
3937
canvas.width = width;
4038
canvas.height = height;
39+
40+
let PARTICLE_COUNT = 700;
41+
if (width < 400) PARTICLE_COUNT = 400;
4142

4243
let verly = new Verly(16, canvas, ctx);
4344

@@ -58,7 +59,7 @@
5859
particles.addPoint(x, y).setRadius(3).setGravity(new Vector(0, 0));
5960
}
6061

61-
for (let i = 0; i < 700; i++) {
62+
for (let i = 0; i < PARTICLE_COUNT; i++) {
6263
addParticles(random(width), random(height));
6364
}
6465

examples/behavior2.html

+7-8
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -37,19 +35,20 @@
3735
window.onload = function () {
3836
let canvas = document.getElementById('c');
3937
let ctx = canvas.getContext('2d');
40-
let width = 600;
41-
let height = 600;
38+
let width = window.innerWidth;
39+
let height = window.innerHeight;
4240
canvas.width = width;
4341
canvas.height = height;
4442

43+
let PARTICLE_COUNT = 400;
4544
let verly = new Verly(16, canvas, ctx);
4645

4746
let particle = new Entity(16, verly);
4847
let p1 = particle.addPoint(0, 0).setRadius(20);
4948
let p2 = particle.addPoint(0, 0).setRadius(20);
5049

51-
for (let i = 0; i < 400; i++) {
52-
particle.addPoint(random(width), random(height));
50+
for (let i = 0; i < PARTICLE_COUNT; i++) {
51+
particle.addPoint(random(width), random(height)).setRadius(4);
5352
}
5453
particle.setGravity(new Vector(0, 0));
5554
verly.addEntity(particle);

examples/dynamicCustomMesh.html

+6-8
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -31,12 +29,12 @@
3129
<script src="../dist/verly.bundle.js"></script>
3230

3331
<script>
34-
32+
3533
window.onload = function () {
3634
let canvas = document.getElementById('c');
3735
let ctx = canvas.getContext('2d');
38-
let width = 600;
39-
let height = 500;
36+
let width = window.innerWidth;
37+
let height = window.innerHeight;
4038
canvas.width = width;
4139
canvas.height = height;
4240

@@ -60,7 +58,7 @@
6058

6159
verly.createRagdoll(100, 100, 100, 100);
6260
verly.addEntity(custom);
63-
61+
6462
function animate() {
6563
ctx.clearRect(0, 0, width, height);
6664

examples/fluidGyroscope.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -34,8 +32,8 @@
3432
window.onload = function () {
3533
let canvas = document.getElementById('c');
3634
let ctx = canvas.getContext('2d');
37-
let width = 600;
38-
let height = 500;
35+
let width = window.innerWidth;
36+
let height = window.innerHeight;
3937
canvas.width = width;
4038
canvas.height = height;
4139

examples/joinEntities.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -34,8 +32,8 @@
3432
window.onload = function () {
3533
let canvas = document.getElementById('c');
3634
let ctx = canvas.getContext('2d');
37-
let width = 600;
38-
let height = 500;
35+
let width = window.innerWidth;
36+
let height = window.innerHeight;
3937
canvas.width = width;
4038
canvas.height = height;
4139

examples/ragdoll.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -36,8 +34,8 @@
3634
window.onload = function () {
3735
let canvas = document.getElementById('c');
3836
let ctx = canvas.getContext('2d');
39-
let width = 600;
40-
let height = 500;
37+
let width = window.innerWidth;
38+
let height = window.innerHeight;
4139
canvas.width = width;
4240
canvas.height = height;
4341

examples/rotatingEntity.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -36,8 +34,8 @@
3634
window.onload = function () {
3735
let canvas = document.getElementById('c');
3836
let ctx = canvas.getContext('2d');
39-
let width = 600;
40-
let height = 600;
37+
let width = window.innerWidth;
38+
let height = window.innerHeight;
4139
canvas.width = width;
4240
canvas.height = height;
4341

examples/shadedCloth.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 10px;
19+
padding: 0;
20+
overflow: hidden;
2021
}
2122

22-
canvas {
23-
outline: 1px solid black;
24-
}
2523
</style>
2624
</head>
2725

@@ -36,8 +34,8 @@
3634
window.onload = function () {
3735
let canvas = document.getElementById('c');
3836
let ctx = canvas.getContext('2d');
39-
let width = 600;
40-
let height = 500;
37+
let width = clamp(window.innerWidth, 600, Infinity);
38+
let height = window.innerHeight;
4139
canvas.width = width;
4240
canvas.height = height;
4341

examples/typography/index.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
html,
1717
body {
1818
margin: 0;
19-
padding: 6px;
19+
padding: 0px;
20+
overflow-y: hidden;
2021
}
2122

2223
canvas {
23-
outline: 1px solid black;
24+
/* outline: 1px solid black; */
2425
}
2526
</style>
2627
</head>

examples/typography/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
window.onload = function () {
77
let canvas = document.getElementById('c');
88
let ctx = canvas.getContext('2d');
9-
let width = 1200;
10-
let height = 500;
9+
let width = clamp(window.innerWidth, 1200, Infinity);
10+
let height = window.innerHeight;
1111
canvas.width = width;
1212
canvas.height = height;
1313
let verly = new Verly(50, canvas, ctx);

0 commit comments

Comments
 (0)