Code edit (3 edits merged)
Please save this source code
User prompt
make markerAxis transparent
Code edit (2 edits merged)
Please save this source code
User prompt
update the line distance = distance; to Adjust distance to ensure segment's end doesn't exeed lowerLimit
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: lowerLimit is not defined' in or related to this line: 'pointA.y = Math.max(lowerLimit, lastSegmentEndY);' Line Number: 288
User prompt
Fix Bug: 'Timeout.tick error: lowerLimiy is not defined' in or related to this line: 'pointA.y = Math.max(lowerLimiy, lastSegmentEndY);' Line Number: 288
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
in console log "new segment index=..." convert rotation to degrees
Code edit (1 edits merged)
Please save this source code
User prompt
update drawSegment and drawSegment call to transmit rotation and width instead of x2,y2
Code edit (4 edits merged)
Please save this source code
User prompt
complete the line : var nextSegmentRotation = 0; // Calculate next segment rotation based on pointA and pointB coordinates
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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: 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
===================================================================
--- original.js
+++ change.js
@@ -17,57 +17,15 @@
if (moveSegments) {
self.x -= slideAmount * 1;
}
if (moveSegmentsVertically) {
- //moveSegmentsVertically) {
var currentDelta = horizontalAxis.y - game.height * 0.75;
var targetY = game.height * 0.75 - dollarToYPixelRatio * self.stockValue1 + currentDelta;
var deltaY = (targetY - self.y) * interpolationSpeed;
- if (self.index1 == 14) {
- 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) + ' currentDelta=' + currentDelta);
- }
self.y += deltaY;
if (Math.abs(deltaY) <= 1) {
self.y = targetY;
}
- //self.y = self.y + currentDelta;
- // Current stock value excedent over 100$ (ignore below 100$)
- /*
- var stockDelta = Math.max(0, stockValuesHistory[graphIndex] - 100);
- var targetY = self.y1 + stockDelta * dollarToYPixelRatio;
- var deltaY = (targetY - self.y) * interpolationSpeed;
- self.y += deltaY;
- if (Math.abs(deltaY) < 1) {
- self.y = targetY;
- }
- if (self.stockValue1 == 100) {
- //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));
- }
- */
- /*
- //var targetY = Math.abs(self.y2 - self.y1) / 2 + currentDelta;
- var targetY = dollarToYPixelRatio * Math.abs(self.stockValue2 - self.stockValue1) / 2 + currentDelta;
- // Smooth interpolation
- var deltaY = (targetY - self.y) * interpolationSpeed;
- self.y += deltaY;
- if (Math.abs(deltaY) < 1) {
- self.y = targetY;
- }
- if (self.stockValue1 == 100) {
- 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));
- }
- */
- // var axisAdjust = 1 * Math.floor(horizontalAxis.y - game.height * 0.75);
- // self.y += verticalSlideAmount * verticalSlideRatio;
- // 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);
- // console.log('Adjusted :' + Math.floor(self.y1) + ' < ' + Math.floor(self.y - axisAdjust) + ' < ' + Math.floor(self.y2) + ' by dol=' + (self.stockValue1 * dollarToYPixelRatio - axisAdjust) + '-' + (self.stockValue2 * dollarToYPixelRatio - axisAdjust) + '(' + axisAdjust + ')');
- // }
- } else {
- if (self.stockValue2 == 100) {
- //console.log(self.stockValue1 + '->' + self.stockValue2, ' Y1: ' + Math.floor(self.y1) + ' < Y: ' + Math.floor(self.y) + ' < Y2: ' + Math.floor(self.y2));
- }
}
};
var segmentGraphics = self.attachAsset('segment', {
anchorY: 0.5
@@ -265,9 +223,8 @@
var pointAXMovement = lastSegmentEndX - pointA.x;
var pointAYMovement = lastSegmentEndY - pointA.y;
pointA.x = lastSegmentEndX;
pointA.y = lastSegmentEndY > lowerLimit ? lowerLimit : lastSegmentEndY;
- // Adjust distance to ensure segment's end doesn't exeed lowerLimit
// Adjust distance to ensure segment's end doesn't exceed lowerLimit
if (pointA.y + Math.sin(nextSegmentRotation) * distance > lowerLimit) {
distance = (lowerLimit - pointA.y) / Math.sin(nextSegmentRotation);
}
@@ -277,9 +234,8 @@
}
var delay = 0.5; // Reduce delay to speed up the drawing of segments
drawingInProgress = true;
drawSegment(game, graphIndex, pointA.x, pointA.y, nextSegmentRotation, distance, delay);
- //graphIndex++;
}
}
function drawSegment(gameRef, index, x1, y1, rotation, width, delay) {
var segment = gameRef.addChild(new GraphSegment());
@@ -322,9 +278,9 @@
}
function setDebugValues() {
stockValuesHistory = [];
var series = [0, 25, 50, 75, 100, 125, 150, 175, 200, 175, 150, 125, 100, 75, 50, 25, 0, 0, 0];
- series = [0, 25, 50, 75, 100, 125, 125, 125, 125, 100, 75, 50, 25, 0, 0, 0];
+ //series = [0, 25, 50, 75, 100, 125, 125, 125, 125, 100, 75, 50, 25, 0, 0, 0];
for (var i = 0; i < 1; i++) {
stockValuesHistory = stockValuesHistory.concat(series);
}
}
@@ -341,10 +297,9 @@
setDebugValues();
var x, y;
// Compute the coordinates for the graph based on stockValuesHistory
for (var i = 0; i < stockValuesHistory.length; i++) {
- x = segmentWidth * i; //Math.min(segmentWidth * i, game.width * 0.75);
- //y = game.height * 0.5 - (stockValuesHistory[i] - 50) * (game.height * 0.5 / 100); // Calculate Y based on new mapping
+ x = segmentWidth * i;
y = game.height * 0.75 - stockValuesHistory[i] * dollarToYPixelRatio; // Calculate Y based on new mapping
graphPoints.push({
x: x,
y: y
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.