User prompt
remove everything related to ValueIndicator. clean the code
User prompt
remove ValueIndicator without altering segments algorithm
Code edit (1 edits merged)
Please save this source code
User prompt
when moveSegments is true, take into account the slide in drawsegment
User prompt
Ensure the linkage between segments. adjuste to account for the distance that the existing segments have already moved to the left. This would ensure that the new segment is connected to the end of the last segment after it has slid, rather than where it was before sliding.
User prompt
Fix new segments not visible when moveSegments is true
User prompt
maintain the linkage between segments, the starting position of the new segment (`x1`, `y1`) need to be adjusted to account for the distance that the existing segments have already moved to the left. This would ensure that the new segment is connected to the end of the last segment after it has slid, rather than where it was before sliding.
Code edit (2 edits merged)
Please save this source code
User prompt
when moveSegments = true continuously add new stockValuesHistory & graphPoints values
User prompt
continuously add new stockValuesHistory & graphPoints values
Code edit (8 edits merged)
Please save this source code
User prompt
keep current ValueIndictor functions and add an additional equivalent slide function to the value indicator
User prompt
add an equivalent slide function to the value indicator
Code edit (1 edits merged)
Please save this source code
User prompt
tune drawNextSegment to have the pointB always follow the ValueIndictor position
Code edit (5 edits merged)
Please save this source code
User prompt
in drawNextSegment update the points & delay calculation to take into account slideAmount when moveSegments is true
User prompt
in drawSegment update the width calculation to take into account slideAmount when moveSegments is true
User prompt
graphpoints x shoud never exeed game center
User prompt
graphPoints x should never exeed game center
User prompt
like for the indicator, segments (x+width) should never exeed the game center
User prompt
move var slideAmount = 4.0; to global scope
Code edit (1 edits merged)
Please save this source code
User prompt
updateSlide call is missinf
User prompt
segments are not sliding when moveSegments is true
===================================================================
--- original.js
+++ change.js
@@ -22,27 +22,49 @@
// ValueIndicator class to represent the current value of the stock on the graph
var ValueIndicator = Container.expand(function () {
var self = Container.call(this);
var indicatorGraphics = self.createAsset('valueIndicator', 'Current Stock Value Indicator', 0.5, 0.5);
+ self.initSlide = function (distance) {
+ self.distanceToSlide = distance;
+ self.startX = self.x;
+ };
+ self.updateSlide = function () {
+ if (moveSegments) {
+ self.x -= slideAmount;
+ self.distanceToSlide -= slideAmount;
+ if (self.distanceToSlide <= 0) {
+ self.distanceToSlide = null;
+ }
+ }
+ };
self.updatePosition = function (price) {
if (!running) {
return;
}
// Position ValueIndicator based on the stock price
- // Function to slide the ValueIndicator to the left
- self.initSlide = function (distance) {
- self.distanceToSlide = distance;
- self.startX = self.x;
- };
- self.updateSlide = function () {
- if (moveSegments) {
- self.x -= slideAmount;
- self.distanceToSlide -= slideAmount;
- if (self.distanceToSlide <= 0) {
- self.distanceToSlide = null;
- }
+ self.x = 0; // Start from the left side
+ self.y = 2732 / 2; // Start from the left side
+ var targetX = game.width; // Center horizontally
+ var targetY = game.height / 2; // Center vertically
+ // Custom tween function to animate the ValueIndicator and update SpecialGraphSegment
+ var startTime = Date.now();
+ var duration = 11000; // Duration in milliseconds
+ var startX = self.x;
+ var endX = targetX;
+ var startY = self.y;
+ var endY = targetY;
+ var animateX = function animateX() {
+ var endTime = startTime + duration;
+ var currentTime = Date.now();
+ var timeRemaining = endTime - currentTime;
+ var nextX = startX + (endX - startX) * (1 - timeRemaining / duration);
+ var nextY = startY + (endY - startY) * (1 - timeRemaining / duration);
+ self.x = nextX;
+ if (currentTime < endTime) {
+ LK.setTimeout(animateX, 16);
}
};
+ animateX();
// Function to animate the ValueIndicator based on stockValuesHistory
var historyIndex = 1; // Start with the first value in the history
var updateYPosition = function updateYPosition() {
if (historyIndex < stockValuesHistory.length) {
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.