Code edit (18 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: currentDelta is not defined' in or related to this line: 'console.log(self.stockValue1 + '->' + self.stockValue2, ' Y1: ' + Math.floor(self.y1) + ' < Y: ' + Math.floor(self.y) + ' < Y2: ' + Math.floor(self.y2), ' / targetY: ' + Math.floor(targetY) + ' -> deltaY: ' + Math.floor(deltaY) + ' Axis: +' + Math.floor(currentDelta));' Line Number: 31
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: segment is not defined' in or related to this line: 'if (moveSegmentsVertically && segment.isFinished) {' Line Number: 19
Code edit (5 edits merged)
Please save this source code
User prompt
add a new independent and fixed horizontal Marker axis at y = game.height *0.25
Code edit (14 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: targetYDollard is not defined' in or related to this line: 'console.log('currentDelta :' + currentDelta + ' / targetY ' + targetY + ' | target $ ' + targetYDollard + ' -> ' + deltaY);' Line Number: 30
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: fixedHAxisY is not defined' in or related to this line: 'console.log('Ok stop Up movement. Stock value:', Math.floor(stockValuesHistory[graphIndex]), 'Axis Y:', Math.floor(self.y), 'Normal Y:', fixedHAxisY);' Line Number: 51
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'width')' in or related to this line: 'console.log("drawNextSegment " + graphIndex + '-' + (graphIndex + 1) + ' w=' + lastSegment.width);' Line Number: 215
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
make the horizontal axis movement fluid, you should implement a smooth interpolation or easing function that gradually adjusts the axis position over time.
Code edit (9 edits merged)
Please save this source code
User prompt
when creating a new segment, set the properties - stockValue1 : the stock value of the start of the segment - stockValue2 : the stock value of the end of the segment - x1 : the x value of the start of the segment - y1 : the y value of the start of the segment - x2 : the x value of the end of the segment - y2 : the y value of the end of the segment
User prompt
set those values in drawSegment function
User prompt
in GraphSegment add properties : - stockValue1 : the stock value of the start of the segment - stockValue2 : the stock value of the end of the segment - x1 : the x value of the start of the segment - y1 : the y value of the start of the segment - x2 : the x value of the end of the segment - y2 : the y value of the end of the segment
User prompt
remove the yValue of the GraphSegment
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
implement setDebugValues() by re-setting stockValuesHistory values by repeating 10 times the serie 50, 75 , 100, 125, 150 , 125, 100, 75 , 50
===================================================================
--- original.js
+++ change.js
@@ -14,9 +14,9 @@
self.x -= slideAmount * 1.0;
}
if (moveSegmentsVertically) {
var axisAdjust = 1 * Math.floor(horizontalAxis.y - game.height * 0.75);
- //self.y += verticalSlideAmount * 0.01;
+ self.y += verticalSlideAmount * 0.02;
//self.y += axisAdjust * 0.02;
if (self.stockValue1 == 200) {
//' Delta = ' + Math.floor(verticalSlideAmount * 0.01) +
console.log('Current :' + Math.floor(self.y1) + ' < ' + Math.floor(self.y) + ' < ' + Math.floor(self.y2) + ' by dol=' + self.stockValue1 * dollarToYPixelRatio + '-' + self.stockValue2 * dollarToYPixelRatio);
@@ -36,15 +36,20 @@
self.isVertical = isVertical; // Property to determine if the axis is vertical
self.yValue = 0; // Track the Y value of the axis for vertical movement
self.updateSlide = function () {
var stockDelta = Math.max(0, stockValuesHistory[graphIndex] - 100);
- var targetY = game.height * 0.75 + stockDelta * dollarToYPixelRatio;
+ var targetY = lowerLimit + stockDelta * dollarToYPixelRatio;
if (!self.isVertical) {
// Smooth interpolation
- self.y += (targetY - self.y) * interpolationSpeed;
+ var deltaY = (targetY - self.y) * interpolationSpeed;
+ self.y += deltaY;
+ if (deltaY < 1) {
+ self.y = targetY;
+ }
+ console.log('moveSegmentsVertically ' + moveSegmentsVertically + ' && self.y (' + self.y + ') <= lowerLimit', moveSegmentsVertically && self.y <= lowerLimit);
if (moveSegmentsVertically && self.y <= lowerLimit) {
self.y = lowerLimit;
- console.log('Ok stop Up movement. Stock value:', Math.floor(stockValuesHistory[graphIndex]), 'Axis Y:', Math.floor(self.y), 'Normal Y:', fixedHAxisY);
+ console.log('Ok stop Up movement. Stock value:', Math.floor(stockValuesHistory[graphIndex]), 'Axis Y:', Math.floor(self.y), 'Normal Y:', horizontalAxis.yValue);
moveSegmentsVertically = false;
}
}
};
@@ -224,14 +229,13 @@
var pointB = graphPoints[graphIndex + 1];
var currentYDelta = Math.abs(horizontalAxis.y - game.height * 0.75);
var upperLimit = game.height * 0.25 - currentYDelta;
var lowerLimit = game.height * 0.75 - currentYDelta;
+ verticalSlideAmount = upperLimit - pointB.y;
if (pointB.y < upperLimit) {
- verticalSlideAmount = upperLimit - pointB.y;
moveSegmentsVertically = true;
console.log("Will Slide Down to augment Y by " + verticalSlideAmount);
} else if (pointB.y > upperLimit && stockValuesHistory[graphIndex + 1] >= 100) {
- verticalSlideAmount = upperLimit - pointB.y;
moveSegmentsVertically = true;
console.log("Will Slide Up to reduce Y by " + verticalSlideAmount);
}
var delay = 0.5; // Reduce delay to speed up the drawing of segments
@@ -250,9 +254,9 @@
segment.x2 = x2;
segment.y2 = y2;
// Adjust segment's y position if vertical movement is enabled
if (moveSegmentsVertically) {
- segment.y += moveSegmentsVertically && y1 < verticalSlideThreshold ? slideAmountVertical : 0;
+ //segment.y += moveSegmentsVertically && y1 < verticalSlideThreshold ? slideAmountVertical : 0;
}
// Add the new segment to the global graphSegments array
graphSegments.push(segment);
console.log('new segment index=' + index + '-' + (index + 1) + " " + stockValuesHistory[index] + "-" + stockValuesHistory[index + 1] + "$", Math.floor(x1), Math.floor(y1), Math.floor(x2), Math.floor(y2));
A Technical dark background. Nothing just a gradiant of colors from black to dark blue. Theme : stock market. background
A modern clean empty rectangular button without borders. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
without shadow
a basic empty ui popup with a black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.