Skip to content

Commit ed05e05

Browse files
author
thyttan
committed
Merge remote-tracking branch 'RKBoss6/loadAnim' into app-loader
2 parents 9fa14f7 + 7b81ac3 commit ed05e05

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed

apps/loadanim/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New test app

apps/loadanim/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Loading Animation (beta)
2+
This is a test to make the UI feel more responsive and fluid, by adding an animation when loading from the clock to a launcher. This app is still in beta, and is in regards to [this discussion](https://github.com/orgs/espruino/discussions/7871).
3+
4+
This modifies the boot code for `Bangle.load()` function, and first shows a 0.15 second animation of an expanding circle, transitioning smoothly between current and the next loaded app. This takes up minimal battery and processing power.
5+
6+
Give it a try, and tag `@RKBoss6` with any improvements or ideas!
7+
8+
## Known bugs
9+
* Memory can run out slightly faster
10+
* A hang will result in a blank screen until the user long-presses the button
11+
## Creator
12+
RKBoss6
13+

apps/loadanim/boot.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function animateExpandCircle(x, y, startR, endR, duration,color) {
2+
var r=startR;
3+
var fps=15
4+
var rChangeRate=(endR-startR)/(duration*fps)
5+
var interval;
6+
var time=0;
7+
interval=setInterval(function(){
8+
time+=1/fps
9+
r+=rChangeRate;
10+
g.setColor(color);
11+
12+
g.fillEllipse(x-r,y-r,x+r,y+r)
13+
if(Math.round(r)==Math.round(endR)||time>duration){
14+
clearInterval(interval)
15+
}
16+
},1/fps)
17+
18+
}
19+
20+
Bangle.load=(function(name) {
21+
if (Bangle.uiRemove) {
22+
var animTime=0.3; //seconds
23+
animateExpandCircle(g.getWidth()/2,g.getHeight()/2,0,150,animTime,g.theme.bg)
24+
Bangle.setUI(); // remove all existing UI (and call Bangle.uiRemove)
25+
__FILE__=name;
26+
if (!name) name = ".bootcde";
27+
setTimeout(eval,animTime*1000,require("Storage").read(name)); // Load app without a reboot
28+
} else load((name!=".bootcde")?name:undefined);
29+
});
30+

apps/loadanim/icon.png

25.2 KB
Loading

apps/loadanim/metadata.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "loadanim",
3+
"name": "Loading Animation",
4+
"shortName":"Load Anim",
5+
"icon": "icon.png",
6+
"version":"0.01",
7+
"description": "Shows an animation to transition into the next loaded app (beta)",
8+
"type":"bootloader",
9+
"tags": "tool,system",
10+
"author":"RKBoss6",
11+
"supports": ["BANGLEJS2"],
12+
"readme":"README.md",
13+
"storage": [
14+
{"name":"loadanim.boot.js","url":"boot.js"}
15+
]
16+
}

0 commit comments

Comments
 (0)