|
Last change
on this file since ba17441 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
329 bytes
|
| Line | |
|---|
| 1 | import {sqrt} from "../math.js";
|
|---|
| 2 |
|
|---|
| 3 | const tan30 = sqrt(1 / 3);
|
|---|
| 4 | const tan30_2 = tan30 * 2;
|
|---|
| 5 |
|
|---|
| 6 | export default {
|
|---|
| 7 | draw(context, size) {
|
|---|
| 8 | const y = sqrt(size / tan30_2);
|
|---|
| 9 | const x = y * tan30;
|
|---|
| 10 | context.moveTo(0, -y);
|
|---|
| 11 | context.lineTo(x, 0);
|
|---|
| 12 | context.lineTo(0, y);
|
|---|
| 13 | context.lineTo(-x, 0);
|
|---|
| 14 | context.closePath();
|
|---|
| 15 | }
|
|---|
| 16 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.