Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/loadanim/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: New test app
19 changes: 19 additions & 0 deletions apps/loadanim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Loading Animation (beta)
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).

This modifies the boot code for `Bangle.load()` function, and first shows a 0.3 second animation of an expanding circle, transitioning smoothly between current and the next loaded app. This takes up minimal battery and processing power.

Give it a try, and tag `@RKBoss6` with any improvements or ideas!

You should see an animation:
* If you have a clock that supports fast-loading
* From a launcher that also supports fast-loading or calls Bangle.load

If you don't see an animation, try using a clock with fast loading, or install fastload utils and see if that works.

## Known bugs
* Memory can run out slightly faster
* A hang will result in a blank screen until the user long-presses the button
## Creator
RKBoss6

30 changes: 30 additions & 0 deletions apps/loadanim/boot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function animateExpandCircle(x, y, startR, endR, duration,color) {
var r=startR;
var fps=15
var rChangeRate=(endR-startR)/(duration*fps)
var interval;
var time=0;
interval=setInterval(function(){
time+=1/fps
r+=rChangeRate;
g.setColor(color);

g.fillEllipse(x-r,y-r,x+r,y+r)
if(Math.round(r)==Math.round(endR)||time>duration){
clearInterval(interval)
}
},1000/fps)

}

Bangle.load=(function(name) {
if (Bangle.uiRemove) {
var animTime=0.3; //seconds
animateExpandCircle(g.getWidth()/2,g.getHeight()/2,0,150,animTime,g.theme.bg)
Bangle.setUI(); // remove all existing UI (and call Bangle.uiRemove)
__FILE__=name;
if (!name) name = ".bootcde";
setTimeout(eval,animTime*1000,require("Storage").read(name)); // Load app without a reboot
} else load((name!=".bootcde")?name:undefined);
});

Binary file added apps/loadanim/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions apps/loadanim/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "loadanim",
"name": "Loading Animation",
"shortName":"Load Anim",
"icon": "icon.png",
"version":"0.01",
"description": "Shows an animation to transition into the next loaded app (beta)",
"type":"bootloader",
"tags": "tool,system",
"author":"RKBoss6",
"supports": ["BANGLEJS2"],
"readme":"README.md",
"storage": [
{"name":"loadanim.boot.js","url":"boot.js"}
]
}