Giter Club home page Giter Club logo

Comments (12)

JakeLin avatar JakeLin commented on May 14, 2024

Will add SlideFadeOutLeft which is like SqueezeFadeOutLeft.

from ibanimatable.

tbaranes avatar tbaranes commented on May 14, 2024

👍

from ibanimatable.

tbaranes avatar tbaranes commented on May 14, 2024

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.

JakeLin avatar JakeLin commented on May 14, 2024

@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.

tbaranes avatar tbaranes commented on May 14, 2024

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.

tbaranes avatar tbaranes commented on May 14, 2024

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.

JakeLin avatar JakeLin commented on May 14, 2024

@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).

  1. Get device width and height as the distance. we may need to set a constant for playground file. And need to consider the orientation.
  2. Traverse up to the top most view.
  3. 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.

tbaranes avatar tbaranes commented on May 14, 2024

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.

JakeLin avatar JakeLin commented on May 14, 2024

@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.

tbaranes avatar tbaranes commented on May 14, 2024

I agree with that. Following the case, the option 3 seems to be the right one using with container view controllers. 👍

from ibanimatable.

JakeLin avatar JakeLin commented on May 14, 2024

@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.

tbaranes avatar tbaranes commented on May 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.