-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is JNWAnimatableWindow interruptible? #10
Comments
What do you mean by interruptible? Do you mean where it interpolates between the current animation state and a new state? |
Like how UIPropoertyAnimator is interruptible. Like you can make animation that is interactive. I'm working on this: https://vimeo.com/208548367 |
Sorry for the delay. The implementation is not very complex, so if you're curious I'd just take a look. The frame resizing animation uses an explicit animation without taking the presentation layer's bounds into account, so it will not interpolate as you're suggesting. That being said, the purpose of this library is to provide access to a layer, which can be animated as you please. It's easily accomplished with the provided by the |
Thx for your reply. Your project came up while I researched NSAnimatablePropertyContainer. I guess its not like the new UIViewPropertyAnimator available since iOS 10. Which is all about being interruptible. |
It's not hard to accomplish the same effect by setting the layer's speed to
0.
…--
Jonathan
On Mar 21, 2017, at 5:40 AM, Eon <[email protected]> wrote:
Thx for your reply. Your project came up while I researched
NSAnimatablePropertyContainer. I guess its not like the new
UIViewPropertyAnimator available since iOS 10. Which is all about being
interruptible.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA08m13QUoUrAgAK-A1G0zvjZz28Z_Xjks5rn8VBgaJpZM4MfaZG>
.
|
Im using Display link. Just found one of your blog posts that helped make it more performant: http://jwilling.com/blog/osx-animations/ Thanks! When are you transitioning to swift? ^^ |
👆 BTW your theory in this blog post is on point. Animating .frame.origin is laggy. Animating with .layer.position is smooth. Very noticeable when the amount of NSViews are numerous. |
I'm still having huge problems getting hitTest to work with .layer.position animation. I think I will have to write a recursive method that traverse up the hierarchy to find the localGlobal and globalLocal position to hit test with. |
Worked! Sharing is caring: This code takes care of converting between local and global coordinates when animating with layer instead of frame: /**
* New
* NOTE: convert(p,nil) usualy converts flipped geometry, but when using layer.position it wont work
*/
func flipY(_ p:CGPoint)->CGPoint{
return CGPoint(p.x, WinParser.height(window!) - p.y)/*flips the window y coordinates*/
}
/**
* New
* Converts global p to local p
*/
func globToLoc(_ p:CGPoint)->CGPoint{
let flippedPoint = flipY(p)
let offset = globalPos()
let localPoint = flippedPoint - offset
return localPoint
}
/**
* New
* Returns the globalPoint of the self.frame.origin (where is this view in the POV of 0,0 of the upper most view)
*/
func globalPos()->CGPoint{
var offset:CGPoint = CGPoint()
var parent:NSView? = self.superview
while parent?.superview != nil {
offset += parent!.layer!.position
parent = parent?.superview
}
return offset
} |
The WinParser: /**
* NOTE: returns the window height (including the titleBar height)
* NOTE: to return window height not including the titleBar height, the use window!.frame.height
* NOTE: this method can also be used if you diff this method and the frame.height to get the titlebar height
* NOTE: to get the width of a window yu can use: window!.frame.width
*/
static func height(_ window:NSWindow)->CGFloat{
return NSWindow.contentRect(forFrameRect: window.frame, styleMask: window.styleMask).height
} |
Nice, thanks for sharing that! |
I just found NSAnimatablePropertyContainer. Then I found your lib on github.
The text was updated successfully, but these errors were encountered: