|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
603 bytes
|
| Rev | Line | |
|---|
| [e4c61dd] | 1 | import {sin, cos, sqrt, pi, tau} from "../math.js";
|
|---|
| 2 |
|
|---|
| 3 | const ka = 0.89081309152928522810;
|
|---|
| 4 | const kr = sin(pi / 10) / sin(7 * pi / 10);
|
|---|
| 5 | const kx = sin(tau / 10) * kr;
|
|---|
| 6 | const ky = -cos(tau / 10) * kr;
|
|---|
| 7 |
|
|---|
| 8 | export default {
|
|---|
| 9 | draw(context, size) {
|
|---|
| 10 | const r = sqrt(size * ka);
|
|---|
| 11 | const x = kx * r;
|
|---|
| 12 | const y = ky * r;
|
|---|
| 13 | context.moveTo(0, -r);
|
|---|
| 14 | context.lineTo(x, y);
|
|---|
| 15 | for (let i = 1; i < 5; ++i) {
|
|---|
| 16 | const a = tau * i / 5;
|
|---|
| 17 | const c = cos(a);
|
|---|
| 18 | const s = sin(a);
|
|---|
| 19 | context.lineTo(s * r, -c * r);
|
|---|
| 20 | context.lineTo(c * x - s * y, s * x + c * y);
|
|---|
| 21 | }
|
|---|
| 22 | context.closePath();
|
|---|
| 23 | }
|
|---|
| 24 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.