Is It Possible to Measure How Fast a Graph Bar Moves From Point A to Point B?

I tried searching around but wasn't quite sure how to phrase it.

Is it possible to measure how fast (in second or hundredths) the green bar move from point A to B?

If a green bar moves from A to B in .556 seconds then do this otherwise to that.

CleanShot 2022-01-16 at 10.54.42@2x

Hey Nat,

You mean you want to watch the graph live and react based upon how fast the green bar moves from A to B?

To do that I think you'd need to use a Pixel condition and scan the known points in a loop.

It looks doable, although I personally haven't done anything like this.

@Sleepy?

-Chris

I'm honored that you would mention me, ccstone.

Indeed, the Find Image action would be good for this, and probably better than the PIXEL function because Find Image can handle small errors like the vertical grey stripe in the screen. PIXEL is best for very precise conditions, whereas Find Image is best when "close is good enough." (Find Image has its own problems, but I don't see that the problems would be a problem in this case.)

But there are some serious questions here regarding timing. There are many ways to interpret the question because the question is ambiguous. Speed is defined as change in position over time, and it's very easy to get the position from Find Image, and also easy to get the time using the MS function in KM. The ambiguity in this case has mostly to do with when the measurements are taken. Do we take "measurement A" at a specific time or when the green bar reaches a specific point? It's not clear, so it's not clear how to write the code.

Basically, I would probably write it like this: (assuming I understand the problem correctly)

  1. Wait until the end of the green bar exists and occurs at least A pixels from the left side of the screen
  2. Record the time from the MS function
  3. Wait until the end of the green bar occurs at least B pixels from the left side of the screen
  4. Record the current time from the MS function
  5. Print the difference in time between the values retrieved from step 4 and step 2 above.
1 Like