Closed mm12 closed 5 years ago
Actually I also experimented in early versions with different change intervals also with seconds instead of minutes. But using a fraction of second instead of a minute as base of the change slider limits also the possible maximum. For example using a 15 seconds interval and having 30 different positions in the slider set the maximum value to 7.5 minutes. Using a 5 sec and you end up with 2,5 minutes as maximum. Finally I thought that very short change intervals are mostly relevant for playing around with the software when it is new and later nobody will mind short intervals and longer intervals become more relevant. And so I ended up with values between 1 minute to 29 minutes and a special value "never".
Anyway if you do not like that decision the software is open source and you can make a fork and easily change the interval to any value you like. I know this was done before form an other person on Github as you see here (it is based on an older version of AnimatedGif): https://github.com/eokuwwy/AnimatedGif/commit/94868163c6686ed17b51b6b8a4bd9c80dfa28439
How would I implement a counter so it counts the number of times and then changes? I just need to know if it has those variables.
The time for changing is permanently stored(even when screensaver is not running) in the ScreenSaverDefaults class and can accessed by the key @"ChangeInterval".
E.g. during startAnimation() it is loaded from this default class into the variable "changeIntervalInMin":
NSInteger changeIntervalInMin = [defaults integerForKey:@"ChangeInterval"];
The variable changeIntervalInMin is than used to start the timer:
changeTimer = [NSTimer scheduledTimerWithTimeInterval:(changeIntervalInMin * 60) target:self selector:@selector(timerMethod) userInfo:nil repeats:NO];
Those "60" is there to convert the value from minutes to seconds. The most easy way to change it would be to replace this "60" with a "1" and then the GIFs will change in a seconds and not minutes.
But if you like to count the number of times an GIF is played (or looped) you need to know when the last frame is drawn and it jumps back the frame 1 of the GIF.
This is done in timerAnimateOneFrame().
//calculate next frame of GIF to show if (currFrameCount < maxFrameCount-1) { currFrameCount++; } else { currFrameCount = FIRST_FRAME; }
The else-case where the setting of the frame counter back to FIRST_FRAME is done is a good place implement a counter how often the GIF has looped.
When you reach your desired number of change intervals (maybe loading a value from the default class like @"ChangeInterval") you can do the same steps that are done in the timerMethod().
- (void)timerMethod { // after change timer is running out this method is called // the animation of last GIF is stopped an memory cleaned, but without destroying GL view or telling the screensaver engine about it (no call of super method; handled by trigByTimer=TRUE) trigByTimer = TRUE; [self stopAnimation]; // the animation is start again witch randomly pics a new GIF from folder and start the change timer again, but without telling the screensaver engine about it (no call of super method; handled by trigByTimer=TRUE) [self startAnimation]; trigByTimer = FALSE; }
The easy way would be just call timerMethod() when you will switch to another GIF. Don't forget to comment out the start of the changeTimer mentioned in my previous post otherwise also the timer will change the GIF when he is running out.
how do i actually turn it into a .saver?
a) Can be done on your project page by pressing the green "Clone or download" button an unzip the file.
b) Or type in the terminal app: git clone https://github.com/mm12/AnimatedGif.git
Closed because submitter try make his feature request in an own fork.
Hi I noticed the time only goes down to 1 minute, and I got to thinking, What about having it count the number of times it plays, then select that time instead, or even just make the min value shorter?
(enhancement)