Animations example is not working

danipendanipen USMember ✭✭
edited October 25 in Xamarin.Mac

Hi,

I'm trying to implement a custom animation based on the CustomizeAnimation example on Github.

I'm trying that example with Visual Studio for Mac 7.2 (Xamarin.Mac version: 3.8.0.49) and the example seems not to work. The line width is not animated. FYI, the method MyView::DefaultAnimationFor is never called.

Could you please help there?

Thanks in advance!

Best Answer

  • JGoldbergerJGoldberger USXamarin Team, University Xamurai
    Accepted Answer

    @danipen

    Working from the sample. I believe I found the error. In the setLineWidth method, you need to setValueForKey instead of SetValueForKeyPath So replace this line in setLineWidth method:

    SetValueForKeyPath((NSNumber) value,(NSString)"drawnLineWidth");
    

    with:

    SetValueForKey((NSNumber) value,(NSString)"drawnLineWidth");
    

    and then the line width is animated after moving the slider.

Answers

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    The sample appears to be broken. I'm looking into it now. Sorry for the trouble.

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    Ok, it looks like this has been broken almost forever (since XM 2.8 at least). I've filed a bug:

    https://bugzilla.xamarin.com/show_bug.cgi?id=60373

  • danipendanipen USMember ✭✭
    edited October 25

    Chris thanks for the info. Seems that it's an issue in the Xamarin.Mac core ...

    Could you thinks an estimate of when it might be fixed?

    FYI I was able to get the DrawLineWidth setter called, however the DefaultAnimationFor method is never called, so the result is that the property is not animated. I also tested to use NSView's instance "animationForKey:" instead the static one defaultAnimationForKey, without luck:

                 [Export("animationForKey:")]
                 public override NSObject AnimationFor(NSString key)
                 {
                      //...
                 }
    

    Thanks!!

  • ChrisHamonsChrisHamons USXamarin Team Xamurai

    I burned two hours this morning looking in to it right now. My initial guess from that is that there is a bug in the proxy NSAnimator code or such.

    Other animation APIs, such as creating NSAnimation manually, seem to work.

    I've scheduled the bug to be look at soon for the 15.6 timeframe (early next year release). I'd hope in the next few days a member of my team could dive into it and figure out what's wrong. Once we know that, then suggesting a work around or length of fix would be more knowable.

    The best way to stay up to date is add yourself as a CC on the linked bug. That way, you'll receive an e-mail when the bug status changes.

  • JGoldbergerJGoldberger USXamarin Team, University Xamurai
    Accepted Answer

    @danipen

    Working from the sample. I believe I found the error. In the setLineWidth method, you need to setValueForKey instead of SetValueForKeyPath So replace this line in setLineWidth method:

    SetValueForKeyPath((NSNumber) value,(NSString)"drawnLineWidth");
    

    with:

    SetValueForKey((NSNumber) value,(NSString)"drawnLineWidth");
    

    and then the line width is animated after moving the slider.

Sign In or Register to comment.