When you have an animated DependencyProperty, how do you remove all active animations? In WPF you could...
myDependencyObject.BeginAnimation(<propery path>, null);
... and that would remove all animations. Is there an equivalent in WinRT (aka Windows Store Apps)?
I have a solution I don't like: keep track of the storyboard to which the animation belongs and manually Stop() it when you want to replace it :/.
Hope this helps somebody.
Edit-
The reason this seems like a poor solution is that it requires the thing that starts the new animation to have some sort of connection to the thing that started the old animation. Ideally the animation target would be affected by different parts of the system at different times and those parts that do the animating would be completely decoupled.
Related
I'm creating a simple (or so I thought) app that allows a user to drag/drop/reorder items within one of two recyclerview lists, or from one list to another. It should animate as you are dragging items, opening gaps that help you easily drop the item into the target spot. This functionality needs to go both ways between the lists. And for extra fun, drag should start on touch, not long press.
In case it makes any difference I'm trying to stick to MVVM, and my 2 recyclerviews are in 2 different fragments, but combined in one screen for this activity.
I'm a relative newbie to android, and using kotlin.
What I have managed so far
I can achieve a nice animation within one recyclerview, using ItemTouchHelper.
OR
I can achieve drag and drop from one recyclerview to the other, and I can start that on touch rather than long press, using View.OnDragListener.
What I can't seem to do is get both of those working at once--drag to another view, but with those beautiful animations ItemTouchHelper provides as the drag is underway.
I have tested all kinds of combinations of attaching customized drag or touchlisteners to my viewholders or recyclerviews. The closest I've gotten to getting things working is attaching the draglistener to the recyclerviews only, in order to receive the dropped view. Then I have set draglisteners and touchhelpers on the viewholders (via the recyclerview adapter).
With this setup I can drag between or within recyclerviews on touch, and have managed to get an animation AFTER drop by calling onItemMove of my adapter (provided as a parameter in my custom draglistener) from within the ACTION_DROP of my dragListener.
I've been working on this for a VERY LONG TIME and googled the heck out of it without luck. Help deeply appreciated.
I am trying to create a Today Widget in Swift with XCode. I started with the available example code of XCode, when you create a new Today Widget target. The content of my Today widget is loaded from an external source, and whenever a new item appears in the external source it is added to the widget on refresh (widgetPerformUpdateWithCompletionHandler).
The only thing that bugs me is that new items automatically slide in from the top, overlapping all previous items and finally reaching the final destination at the bottom of the list. How can I change this behavior to either slide in from the bottom or not at all and just appear without sliding. I think I know how I could do my own animation with ...view.animator()... but the original functionality is nowhere to be found in my code and I can't figure out how to disable it.
By now I'm pretty sure where it comes from. I assume the list items NSView is initiated with NSViewControllerTransitionOptions and the SlideDown option activated. So the animation comes from the views NSViewControllerPresentationAnimator. Unfortunately presentViewController is not called by myself. This probably is somewhere in the internals of NCWidgetListViewDelegate, which has no option to prevent or change the animation. So I guess, the only way how to "fix" this is to drop NCWidgetListViewDelegate completely and start from scratch. So the answer would be: It's not possible.
I'm an intermediate iOS developer who's trying to jump on the OSX side of things.
I've been struggling to create an accordion-like display of several views, where only one view at a time can be unfolded to occupy the whole parent's view's available space. In other words, click on a view's title bar, it will both open/unfold this view and close/fold the currently open view, with animations'n'all. Oh end, I need the views' contents to be scrollable.
I tried starting from Apple's NSStackView sample code, but first it is not quite what I want, and what's more, I can't figure out how to start from here to end up where I eventually want to be.
Then I tried to master the Auto-Layout facilities but with no success. Truth be told, this whole Auto-Layout thing still confuses me some.
Does any of you have clues as to how I should proceed? Sample code? Tutorials (I tried several Auto-Layout tutorial but at the end of the day they still leave me missing the tricks I'd need to figure...).
Thanks.
/Julian
Check out the sample code: InfoBarStackView. It creates an accordion-like interface, the one difference from what you're describing is it lets multiple views be revealed at the same time (although, that's a simple difference).
It uses NSStackView and autolayout constraints to create the interface and drive the reveal/hide animations.
The stack view could also be put into an NSScrollView to allow the content to be scrollable. (Something similar was done during a WWDC 2013 Cocoa Animation talk).
I have an animation and I want to show several time hints at certain points.
What is the best way of doing that?
I tried to make events in animation.. and call function which should notify the main GUI class, that something changed, but I am not sure if it is a good solution.
(actually I do not know how to do it effectively).
Or I can make a loop in my main GUI class, just reacting to time.. but I am not sure if the synchronization will be ok.
If it is a cutscene like animation, I would use these animation events. This way it is easy to edit it later, if something changes in the animation. If you calculate seconds in the code while playing the animation, it will be a maintenance hell.
Although I know of a solution to this problem, I am interested if someone can explain this solution to me. I also wanted to get this out there because I could not find any mention of this problem online, and it took me several hours over several days to track down. I have an NSTableView behaving strangely regarding redraws and its selection. The problem looks like this:
Table contents fades in, instead of appearing instantly upon it's appearance on screen. When scrolling through the contents, the newly appearing rows also fade in. When you make a selection (single or multiple), and scroll it off screen, then make another selection (that should replace, not add-to first selection), the first selection does not get cleared properly. If you scroll back to it, it is still there, in addition to your new selection. This is a display-update problem, not selection problem - i.e. your new selection is valid, it is just displayed wrong.
I tracked this through the NSArrayController I was binding to, the underlying Array, sorting, all the connections, and settings, etc., but all that has nothing to do with it.
What solved the problem was:
In the View Effects (right-most) Inspector, uncheck "Core Animation Layer" for the Window's main view.
Can anyone explain what is happening here, and perhaps improve upon the solution ?
It looks like Core Animation and NSTableView aren't getting along so well. The "fading" effect is a by-product of the way core animation works. When you have core animation in one view, it is also enabled in all of that view's subviews.
I don't recommend using core animation on the Mac unless absolutely necessary, because some interface elements (NSTextView and NSTableView, for example) aren't compatible with it. iOS has much better support for table views and such using core animation, mainly because it was designed with core animation in mind.
I know that some more simple UI elements are compatible (NSTextField and NSButton, for example).
If you absolutely need core animation in the rest of the window, put all the other views in a subview of the content view, while leaving the table view directly in the content view. You can then enable Core Animation in the other view.
Commenters, feel free to add to the list of what is and isn't compatible.