FastLED 3.9.12
Loading...
Searching...
No Matches
frame_tracker.h
1#pragma once
2
3#include <stdint.h>
4
5#include "fl/namespace.h"
6
7// #include <iostream>
8
9// using namespace std;
10
11namespace fl {
12
13// Tracks the current frame number based on the time elapsed since the start of the animation.
15 public:
16 FrameTracker(float fps);
17
18 // Gets the current frame and the next frame number based on the current time.
19 void get_interval_frames(uint32_t now, uint32_t* frameNumber, uint32_t* nextFrameNumber, uint8_t* amountOfNextFrame = nullptr) const;
20
21 // Given a frame number, returns the exact timestamp in milliseconds that the frame should be displayed.
22 uint32_t get_exact_timestamp_ms(uint32_t frameNumber) const;
23
24
25 uint32_t microsecondsPerFrame() const {
26 return mMicrosSecondsPerInterval;
27 }
28
29 private:
30 uint32_t mMicrosSecondsPerInterval;
31 uint32_t mStartTime = 0;
32};
33
34
35} // namespace fl
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16