circular-mirror 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +16 -159
- package/js/main.js +112 -103
- package/package.json +20 -4
- package/CONTRIBUTING.md +0 -66
- package/DOCUMENTATION.md +0 -164
- package/css/README.md +0 -1
- package/css/bg.png +0 -0
- package/css/bg2.png +0 -0
- package/css/caiuss.min.css +0 -4
- package/css/octicons/LICENSE.txt +0 -9
- package/css/octicons/octicons-local.ttf +0 -0
- package/css/octicons/octicons.css +0 -235
- package/css/octicons/octicons.eot +0 -0
- package/css/octicons/octicons.less +0 -233
- package/css/octicons/octicons.svg +0 -198
- package/css/octicons/octicons.ttf +0 -0
- package/css/octicons/octicons.woff +0 -0
- package/css/octicons/sprockets-octicons.scss +0 -230
- package/css/style.css +0 -16
- package/index.html +0 -46
- package/js/jquery-1.8.3.min.js +0 -9343
- package/js/jquery.min.js +0 -2628
- package/theory +0 -105
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2013-
|
|
3
|
+
Copyright (c) 2013-26 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,93 +1,19 @@
|
|
|
1
1
|
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
3
|
# circular-mirror
|
|
21
4
|
|
|
22
|
-
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://www.npmjs.com/package/circular-mirror) [](https://www.npmjs.com/package/circular-mirror) [](https://www.codementor.io
|
|
5
|
+
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://www.npmjs.com/package/circular-mirror) [](https://www.npmjs.com/package/circular-mirror) [](https://www.codementor.io/@johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
|
|
23
6
|
|
|
24
7
|
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
9
|
> Simulates the reflections of a ray of light inside of a circular mirror.
|
|
33
10
|
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## :question: Get Help
|
|
70
|
-
|
|
71
|
-
There are few ways to get help:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
|
|
76
|
-
2. For bug reports and feature requests, open issues. :bug:
|
|
77
|
-
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
11
|
## :memo: Documentation
|
|
84
12
|
|
|
85
|
-
|
|
86
13
|
### `round(num, decimals)`
|
|
87
14
|
Rounds a number.
|
|
88
15
|
|
|
89
16
|
#### Params
|
|
90
|
-
|
|
91
17
|
- **Number** `num`: The input number.
|
|
92
18
|
- **Number** `decimals`: How many decimals.
|
|
93
19
|
|
|
@@ -98,7 +24,6 @@ Rounds a number.
|
|
|
98
24
|
Sets a variable interval.
|
|
99
25
|
|
|
100
26
|
#### Params
|
|
101
|
-
|
|
102
27
|
- **Function** `callbackFunc`: The callback function.
|
|
103
28
|
- **Number** `timing`: The interval value.
|
|
104
29
|
|
|
@@ -109,21 +34,16 @@ Sets a variable interval.
|
|
|
109
34
|
Draws a circle on the canvas.
|
|
110
35
|
|
|
111
36
|
#### Params
|
|
112
|
-
|
|
113
37
|
- **Number** `x`: The x value.
|
|
114
38
|
- **Number** `y`: The y value.
|
|
115
39
|
- **Number** `r`: The radius value.
|
|
116
40
|
- **Number** `w`: The line width.
|
|
117
41
|
- **String** `color`: The color.
|
|
118
42
|
|
|
119
|
-
#### Return
|
|
120
|
-
- ****
|
|
121
|
-
|
|
122
43
|
### `line(x1, y1, x2, y2, w, color)`
|
|
123
44
|
Draws a line on the canvas.
|
|
124
45
|
|
|
125
46
|
#### Params
|
|
126
|
-
|
|
127
47
|
- **Number** `x1`: The source `x` value.
|
|
128
48
|
- **Number** `y1`: The source `y` value.
|
|
129
49
|
- **Number** `x2`: The target `x` value.
|
|
@@ -131,46 +51,29 @@ Draws a line on the canvas.
|
|
|
131
51
|
- **Number** `w`: The line width.
|
|
132
52
|
- **String** `color`: The color.
|
|
133
53
|
|
|
134
|
-
#### Return
|
|
135
|
-
- ****
|
|
136
|
-
|
|
137
54
|
### `canvasArrow(context, fromx, fromy, tox, toy)`
|
|
138
55
|
Draws an arrow on the canvas.
|
|
139
56
|
|
|
140
57
|
#### Params
|
|
141
|
-
|
|
142
58
|
- **Object** `context`: The canvas context.
|
|
143
59
|
- **Number** `fromx`: The source `x` value.
|
|
144
60
|
- **Number** `fromy`: The source `y` value.
|
|
145
61
|
- **Number** `tox`: The target `x` value.
|
|
146
62
|
- **Number** `toy`: The target `y` value.
|
|
147
63
|
|
|
148
|
-
#### Return
|
|
149
|
-
- ****
|
|
150
|
-
|
|
151
64
|
### `init()`
|
|
152
65
|
This function is called to reinit the canvas.
|
|
153
66
|
|
|
154
|
-
#### Return
|
|
155
|
-
- ****
|
|
156
|
-
|
|
157
67
|
### `draw()`
|
|
158
68
|
Starts drawing the things.
|
|
159
69
|
|
|
160
|
-
#### Return
|
|
161
|
-
- ****
|
|
162
|
-
|
|
163
70
|
### `handlers()`
|
|
164
71
|
This function appends the DOM handlers.
|
|
165
72
|
|
|
166
|
-
#### Return
|
|
167
|
-
- ****
|
|
168
|
-
|
|
169
73
|
### `getLimit(angle)`
|
|
170
74
|
This is a **hack**. This roundes the angle in a format that is supported by the application.
|
|
171
75
|
|
|
172
76
|
#### Params
|
|
173
|
-
|
|
174
77
|
- **Number** `angle`: The angle that should be rounded.
|
|
175
78
|
|
|
176
79
|
#### Return
|
|
@@ -180,33 +83,24 @@ This is a **hack**. This roundes the angle in a format that is supported by the
|
|
|
180
83
|
Checks if the angle is supported.
|
|
181
84
|
|
|
182
85
|
#### Params
|
|
183
|
-
|
|
184
86
|
- **Number** `angle`: The angle that should be checked.
|
|
185
87
|
|
|
186
88
|
#### Return
|
|
187
|
-
- **String** An error (string) or `null`.
|
|
89
|
+
- **null|String** An error (string) or `null`.
|
|
188
90
|
|
|
189
91
|
### `showError(message)`
|
|
190
92
|
Shows an error message.
|
|
191
93
|
|
|
192
94
|
#### Params
|
|
193
|
-
|
|
194
95
|
- **String** `message`: The error message.
|
|
195
96
|
|
|
196
|
-
#### Return
|
|
197
|
-
- ****
|
|
198
|
-
|
|
199
97
|
### `start(point, callback)`
|
|
200
98
|
Draws the lines on the canvas.
|
|
201
99
|
|
|
202
100
|
#### Params
|
|
203
|
-
|
|
204
101
|
- **Point** `point`: The current point.
|
|
205
102
|
- **Function** `callback`: The callback function.
|
|
206
103
|
|
|
207
|
-
#### Return
|
|
208
|
-
- ****
|
|
209
|
-
|
|
210
104
|
### `M(A:, B:, R:, L:)`
|
|
211
105
|
THE MOST IMPORTANT FUNCTION.
|
|
212
106
|
It always returns the next point.
|
|
@@ -217,7 +111,6 @@ Radius ---> |? ? ?|
|
|
|
217
111
|
Length of segments ---> ------------
|
|
218
112
|
|
|
219
113
|
#### Params
|
|
220
|
-
|
|
221
114
|
- **Object** `A:`: first point
|
|
222
115
|
- **Object** `B:`: second point
|
|
223
116
|
- **Object** `R:`: radius of big circle
|
|
@@ -227,7 +120,6 @@ Length of segments ---> ------------
|
|
|
227
120
|
The function that returns ONLY the first point.
|
|
228
121
|
|
|
229
122
|
#### Params
|
|
230
|
-
|
|
231
123
|
- **Object** `m`:
|
|
232
124
|
- **Object** `x1`:
|
|
233
125
|
- **Object** `y1`:
|
|
@@ -243,75 +135,40 @@ Function that returns a point giving the angle
|
|
|
243
135
|
Verify if the numbers are correct.
|
|
244
136
|
If not, return an false value.
|
|
245
137
|
|
|
138
|
+
## :question: Get Help
|
|
246
139
|
|
|
140
|
+
There are a few ways to get help:
|
|
247
141
|
|
|
142
|
+
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long as you add a link to your Stack Overflow question.
|
|
143
|
+
2. For bug reports and feature requests, open issues. :bug:
|
|
144
|
+
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
|
248
145
|
|
|
146
|
+
## :yum: How to Contribute
|
|
249
147
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
## :yum: How to contribute
|
|
260
148
|
Have an idea? Found a bug? See [how to contribute][contributing].
|
|
261
149
|
|
|
150
|
+
## :sparkling_heart: Support My Projects
|
|
262
151
|
|
|
263
|
-
|
|
264
|
-
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
|
265
|
-
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).
|
|
266
|
-
|
|
267
|
-
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
|
|
152
|
+
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute it (even resell it).
|
|
268
153
|
|
|
154
|
+
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are a few ways you can do it:
|
|
269
155
|
|
|
270
156
|
- Starring and sharing the projects you like :rocket:
|
|
271
|
-
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you
|
|
157
|
+
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you for years if you buy me one. :grin: :book:
|
|
272
158
|
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
|
273
159
|
- [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
|
|
274
|
-
- **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
|
275
|
-
|
|
276
|
-

|
|
160
|
+
- **Bitcoin**—You can send me bitcoins at this address (or by scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`
|
|
277
161
|
|
|
162
|
+

|
|
278
163
|
|
|
279
164
|
Thanks! :heart:
|
|
280
165
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
166
|
## :scroll: License
|
|
305
167
|
|
|
306
168
|
[MIT][license] © [Ionică Bizău][website]
|
|
307
169
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
170
|
[license]: /LICENSE
|
|
314
|
-
[website]:
|
|
171
|
+
[website]: https://ionicabizau.net
|
|
315
172
|
[contributing]: /CONTRIBUTING.md
|
|
316
173
|
[docs]: /DOCUMENTATION.md
|
|
317
174
|
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg
|
|
@@ -319,5 +176,5 @@ Thanks! :heart:
|
|
|
319
176
|
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
|
|
320
177
|
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
|
|
321
178
|
[patreon]: https://www.patreon.com/ionicabizau
|
|
322
|
-
[amazon]:
|
|
179
|
+
[amazon]: https://amzn.eu/hRo9sIZ
|
|
323
180
|
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|