mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
fade: throw a 10ms cap in, improves visual and lessens load
This commit is contained in:
parent
148114c6ca
commit
d4caefc55d
@ -173,7 +173,7 @@ int unicodeblocks_demo(struct notcurses* nc){
|
||||
// we don't want a full delay period for each one, urk...or do we?
|
||||
struct timespec subdelay;
|
||||
uint64_t nstotal = timespec_to_ns(&demodelay);
|
||||
ns_to_timespec(nstotal / 5, &subdelay);
|
||||
ns_to_timespec(nstotal / 3, &subdelay);
|
||||
for(sindex = 0 ; sindex < sizeof(blocks) / sizeof(*blocks) ; ++sindex){
|
||||
ncplane_set_bg_rgb(n, 0, 0, 0);
|
||||
//ncplane_erase(n);
|
||||
|
@ -99,6 +99,10 @@ int ncplane_fadein(ncplane* n, const struct timespec* ts, fadecb fader){
|
||||
int maxsteps = maxfsteps > maxbsteps ? maxfsteps : maxbsteps;
|
||||
uint64_t nanosecs_total = ts->tv_sec * NANOSECS_IN_SEC + ts->tv_nsec;
|
||||
uint64_t nanosecs_step = nanosecs_total / maxsteps;
|
||||
while(nanosecs_step < 10000000){ // 10msec
|
||||
nanosecs_step *= 10;
|
||||
maxsteps = nanosecs_total / nanosecs_step;
|
||||
}
|
||||
struct timespec times;
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
// Start time in absolute nanoseconds
|
||||
@ -174,6 +178,10 @@ int ncplane_fadeout(struct ncplane* n, const struct timespec* ts, fadecb fader){
|
||||
int maxsteps = maxfsteps > maxbsteps ? maxfsteps : maxbsteps;
|
||||
uint64_t nanosecs_total = ts->tv_sec * NANOSECS_IN_SEC + ts->tv_nsec;
|
||||
uint64_t nanosecs_step = nanosecs_total / maxsteps;
|
||||
while(nanosecs_step < 10000000){ // 10msec
|
||||
nanosecs_step *= 10;
|
||||
maxsteps = nanosecs_total / nanosecs_step;
|
||||
}
|
||||
struct timespec times;
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
// Start time in absolute nanoseconds
|
||||
|
Loading…
Reference in New Issue
Block a user