sine line fix & simplification
Corrected first sine line section. Removed radius offset from sine line x values. & Simplifiedmaster
parent
2993d391d5
commit
5a54681954
|
|
@ -183,7 +183,7 @@ function drawSinuses () {
|
||||||
g.setColor(1, 1, 1);
|
g.setColor(1, 1, 1);
|
||||||
let y = ypos(x);
|
let y = ypos(x);
|
||||||
while (x < w) {
|
while (x < w) {
|
||||||
y2 = ypos(x);
|
y2 = ypos(x + sinStep);
|
||||||
g.drawLine(x, y, x + sinStep, y2);
|
g.drawLine(x, y, x + sinStep, y2);
|
||||||
y = y2;
|
y = y2;
|
||||||
x += sinStep; // no need to draw all steps
|
x += sinStep; // no need to draw all steps
|
||||||
|
|
@ -225,7 +225,7 @@ function drawGlow () {
|
||||||
}
|
}
|
||||||
const rh = r / 2;
|
const rh = r / 2;
|
||||||
const x = pos;
|
const x = pos;
|
||||||
const y = ypos(x - r);
|
const y = ypos(x);
|
||||||
const r2 = 0;
|
const r2 = 0;
|
||||||
if (x > sunRiseX && x < sunSetX) {
|
if (x > sunRiseX && x < sunSetX) {
|
||||||
g.setColor(0.2, 0.2, 0);
|
g.setColor(0.2, 0.2, 0);
|
||||||
|
|
@ -246,8 +246,7 @@ function seaLevel (hour) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ypos (x) {
|
function ypos (x) {
|
||||||
const pc = (x * 100 / w);
|
return oy + (32 * Math.sin(1.7 + (x * 100 / (16 * w))));
|
||||||
return oy + (32 * Math.sin(1.7 + (pc / 16)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function xfromTime (t) {
|
function xfromTime (t) {
|
||||||
|
|
@ -260,7 +259,7 @@ function drawBall () {
|
||||||
if (frames < 1 && realTime) {
|
if (frames < 1 && realTime) {
|
||||||
x = xfromTime(now.getHours());
|
x = xfromTime(now.getHours());
|
||||||
}
|
}
|
||||||
const y = ypos(x - r);
|
const y = ypos(x);
|
||||||
|
|
||||||
// glow
|
// glow
|
||||||
if (x < sunRiseX || x > sunSetX) {
|
if (x < sunRiseX || x > sunSetX) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue