-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (46 loc) · 2.26 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Click the canvas!</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<main class="main">
<canvas id="canvas"></canvas>
</main>
<aside class="box info-bar" id="info-bar">
<p>Select 3 points in the free area of the right and then move them around</p>
<div class="info-bar__actions">
<button class="btn btn--main" disabled>Start again</button>
<button class="btn">About</button>
</div>
<table></table>
</aside>
<article class="box about-info" id="about">
<button class="about-info__close" data-close>X</button>
<h1>Click the canvas! app</h1>
<h2>About me</h2>
<p>My name is John Cely, I was born in Colombia and I've been developing software for seven years.</p>
<h2>The solution</h2>
<p>This is my solution for the geometrical shapes JS assignment.</p>
<h3>The tools and APIs I used</h3>
<ul>
<li>TypeScript 3 as I think having types in a language is a great feature for writing more readable code.</li>
<li>HTML 5 canvas API because I think it is the perfect fit for this kind of application.</li>
<li>FabricJS is a library on top of the canvas API that provides a high level interface for painting, listening for events and updating the canvas.</li>
</ul>
<h2>How it works?</h2>
<p>It's very easy, simply click on the grey space 3 times, each click will set a point. After the third point, the app will find a fourth one in such a way that they'll match the vertices of a parallelogram. A yellow circle will be painted. This circle will have the same area and center of mass as the parallelogram.</p>
<p>After that you will be able to drag any point, and as you do it, a second point will also move causing the figure to remain a parallelogram. The circle will move and resize accordingly.</p>
</article>
<dialog class="dialog" id="error-dialog" open>
<p data-error-message></p>
<p>Start again</p>
</dialog>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.22/fabric.min.js"></script>
<script src="main.ts"></script>
</body>
</html>