https://github.com/Likenttt/garmin-ciq-page-indicator
Garmin CIQ Page Indicator(Native-like)Base on sample Primates
https://github.com/Likenttt/garmin-ciq-page-indicator
Last synced: 3 months ago
JSON representation
Garmin CIQ Page Indicator(Native-like)Base on sample Primates
- Host: GitHub
- URL: https://github.com/Likenttt/garmin-ciq-page-indicator
- Owner: Likenttt
- Created: 2023-07-25T08:57:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-25T08:58:47.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T19:17:59.145Z (7 months ago)
- Language: Monkey C
- Size: 480 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-garmin - garmin-ciq-page-indicator - like)Base on sample Primates | 2023‑07‑25 | ⭐2 | (Barrels / Older resources)
- awesome-garmin - garmin-ciq-page-indicator - like)Base on sample Primates | 2023‑07‑25 | ⭐2 | (Barrels / Older resources)
README
# Garmin CIQ Page Indicator(Native-like)
Core code:
```js
public function draw(dc as Dc, selectedIndex as Number) as Void {
var height = 20;
for (var i = 0; i < _size; i++) {
if (i == selectedIndex) {
dc.setColor(_selectedColor, Graphics.COLOR_TRANSPARENT);
} else {
dc.setColor(_notSelectedColor, Graphics.COLOR_TRANSPARENT);
}
//b is the distance between dot's centers to the center of the round screen
var b = dc.getWidth() / 2 - height;//round page indicator
//3.14 is the initial radian
//0.2 is the increasing radian between two page indicators
var x_i = b * Math.cos(3.14 - (i - 1) * 0.2) + dc.getWidth() / 2;
var y_i = b * Math.sin(3.14 - (i - 1) * 0.2) + dc.getWidth() / 2;
dc.fillCircle(x_i, y_i, height / 2);
}
}
```
Have fun~
## Credit:
- The sample project Primates by Garmin