Comments (12)
Will add SlideFadeOutLeft
which is like SqueezeFadeOutLeft
.
from ibanimatable.
👍
from ibanimatable.
After check the implementation of SqueezeFadeOutLeft
, we will have the same issue, the slideOut
should go outside of the screen, whatever is the distance between it's current position, and the next one, isn't it?
from ibanimatable.
@tbaranes you are right. that is the problem of SlideOut
animations. The slide out animations require the width or height of the device. And the animating element itself doesn't have the info. All we can use UIScreen. mainScreen. bounds
to get. Or we can add some animations like moveX()
, moveY()
. That may fix this issue. Do you have any suggestions?
from ibanimatable.
We shouldn't use UIScreen
to get the frame since the container where we are doing the animation could have any frame depending of the context.
Something like that would be more appropriate:
public func slideOutLeft(completion: AnimatableCompletion? = nil) {
let x = -frame.width * force
animateOutWithX(x, alpha: 1, completion: completion);
}
public func slideOutRight(completion: AnimatableCompletion? = nil) {
guard let unwrappedSuperview = self.superview else {
return
}
let x = unwrappedSuperview.frame.maxX * force
animateOutWithX(x, alpha: 1, completion: completion);
}
The only bad point is that we can't use Animatable
without an UIView
but it won't be a big issue, is it?
from ibanimatable.
After a better looking in the code, the solution would be more something like this:
public func slideOutDown(completion: AnimatableCompletion? = nil) {
guard let unwrappedSuperview = self.superview else {
return
}
let y = (unwrappedSuperview.frame.height - frame.minY) * force
animateInWithY(y, completion: completion)
}
I will make some tests, and a PR if that's working on monday
from ibanimatable.
@tbaranes My concern is the animating view may not be the directly subview of the the root view. For example, VC.view -> UIStackView(not 100% width and height) -> UIView(one item within StackView) -> AnimatableView.
I have some ideas to get the distance (width/height).
- Get device width and height as the distance. we may need to set a constant for playground file. And need to consider the orientation.
- Traverse up to the top most view.
- Get the associated VC then use VC.view.
I don't know which one can be the solution yet. please let me know if you have any ideas.
from ibanimatable.
Oh right, I didn't think about the UIStackView
issue. I'm not sure how you can really handle all the case. Maybe the point 2 / 3 or the best one, but it won't be exact all the time following if we want to slide out of the screen or just the container. Maybe we need to handle the both cases?
from ibanimatable.
@tbaranes To slide out the container. we can use containerView, then put a VC within it. that's why i put the 3rd option above. But I haven't thought carefully for all options. But first thing would be side out of the screen.
I think the library is hard to handle 100% of scenarios. It need to add a lot of @IBInspectable
properties to support more customisation. We need to balance that.
from ibanimatable.
I agree with that. Following the case, the option 3 seems to be the right one using with container view controllers. 👍
from ibanimatable.
@tbaranes using the device width/height should be a feasible solution. In that case if we want to slide out from a sub view (container view) we still can slide out but it will move further. In our case, it looks faster that it should be because the visible distance is shorter than the actual moving distance. We can modify some parameters to customise the speed.
from ibanimatable.
I think it's add complexity following the usage case. Anyway, it's still a good option, improvable later if necessary.
from ibanimatable.
Related Issues (20)
- Chaining doesn't work at all HOT 1
- CALayerInvalidGeometry CALayer position contains NaN: [nan 11] HOT 1
- Accio installation fails HOT 3
- AnimatableModalViewController enable userInteraction on previous VC HOT 1
- Animations work without IB? HOT 2
- Update in to swift 5 HOT 1
- Animate rotate infinite? HOT 1
- SwiftUI integration / support HOT 2
- Module 'IBAnimatable' was not compiled with library evolution support HOT 1
- IBAnimatable with SPM & XCode 11 -> "currentMediaTime" unknown property HOT 1
- full view gradient (on main view) does not redraw upon screen orientation changing HOT 3
- Is there a mask which rounds certain selected sides? HOT 1
- Swift Package 6.0 compilation error HOT 7
- is there a mask for semicircle / cords? HOT 1
- CFBundleVersion issue while compiling demo code. How to resolve this issue?? HOT 4
- Image tint color for left and right textfield images.
- Button with IBAnimatable in iOS 14 title not display complete HOT 5
- Image going out of frame while apply shadow
- SPM Compiler Errors HOT 2
- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>0.5.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> <key>NSPrincipalClass</key> <string></string> </dict> </plist 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 ibanimatable.