Comments (7)
i am trying to use the project to display a gif as a splash screen, it would be nice to get the duration of the animation to start a new viewcontroller after a specific duration
from gifu.
No it is not. It could be something that the API exposes though. What you need that info for?
from gifu.
Yes, that is not unreasonable.
from gifu.
i am following the same approach on the android version of my project and for that i am using this project https://github.com/koral--/android-gif-drawable
and that project exposes this set of APIs
stop() - stops the animation, can be called from any thread
start() - starts the animation, can be called from any thread
isRunning() - returns whether animation is currently running or not
reset() - rewinds the animation, does not restart stopped one
setSpeed(float factor) - sets new animation speed factor, eg. passing 2.0f will double the animation speed
seekTo(int position) - seeks animation (within current loop) to given position (in milliseconds)
getDuration() - returns duration of one loop of the animation
getCurrentPosition()
they also expose an event listener that is triggered on animation completion which can be used to start a new controller
this is the equivalent in android
gifDrawable.addAnimationListener(new AnimationListener() {
@Override
public void onAnimationCompleted() {
Log.d(TAG, "splash screen animation complete...starting activity");
if (gifDrawable.canPause()) {
gifDrawable.pause();
}
Intent i = new Intent(SplashScreen.this, MainActivity.class);
startActivity(i);
}
});
it would be nice to have something similar
from gifu.
Thanks for sharing this @fouadkada. I had thought about adding some of these and this is a good reference. I'd happily welcome PRs as well.
from gifu.
+1 on this as well. I'm working in a project that is dependent on showing a new view controller when the gif image has finished. It would be great for this to be dynamic instead having to manually find out the duration of the gif file.
from gifu.
This can be done using GIFAnimatable.gifLoopDuration
starting https://github.com/kaishin/Gifu/releases/tag/v3.0.0 😉 It used to be there before but didn't work properly if called immediately after calling any of the animate()
functions.
from gifu.
Related Issues (20)
- Support iOS 14 HOT 4
- GIFs without Duration-Info play too fast HOT 2
- iOS 14 GIFAnimatable UIKit extension doesn't play GIF HOT 24
- SwiftPM Package Resolution Failed for v3.3 HOT 7
- Gifu.h is unneeded
- Compatibility with objc
- Value of type 'GIFImageView' has no member 'animatedFrames'
- In the app, GIF quality degraded, but correct in the Google drive with same file(size) HOT 1
- Index out of range HOT 1
- Static GIF Image not show properly HOT 1
- Support other image formats HOT 1
- Gifu animate method not displaying gif HOT 1
- Spurious console logs related to zero-sized imaging HOT 1
- Version number is wrong in ppdspec file for 3.4 release HOT 2
- Not working HOT 1
- Not able to update to latest version 3.4.1
- How to get framework using Tuist?
- Improve how Gifu uses system resources HOT 2
- loopDuration is inaccessible in Animator object HOT 1
- Xcode does not support version format like `v3.4.1` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gifu.