• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAnimatablePropertyContainer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAnimatablePropertyContainer


  • Subject: Re: NSAnimatablePropertyContainer
  • From: "I. Savant" <email@hidden>
  • Date: Fri, 16 Nov 2007 14:00:31 -0500

> ... for example, animate a custom
> "transitionProgress" property from 0.0 to 1.0, and have your view's -
> drawRect: do something like:
>
> [[NSColor whiteColor] set];
> NSRectFill(rect);
>
> float t = [self transitionProgress];
> if (t < 0.5) {
>      [oldImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:(2.0 * (0.5 - t))];
> } else {
>      [newImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:(2.0 * (t - 0.5))];
> }
>
> That's one way it could be done.

  I've just tried this and it works beautifully. Thanks, Troy! The
trick was (on setImage:) to do the following:

[self setTransitionProgress:0.0]; // no animation, just start from 0
oldImage = image;
image = newImage;
[[self animator] setTransitionProgress:1.0];

  ... I implemented your code above in my own -drawRect: and it worked
just fine.

--
I.S.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSAnimatablePropertyContainer (From: "I. Savant" <email@hidden>)
 >Re: NSAnimatablePropertyContainer (From: Troy Stephens <email@hidden>)
 >Re: NSAnimatablePropertyContainer (From: "I. Savant" <email@hidden>)
 >Re: NSAnimatablePropertyContainer (From: Troy Stephens <email@hidden>)

  • Prev by Date: disable quick look server for files
  • Next by Date: Re: IS-A relationships in core data
  • Previous by thread: Re: NSAnimatablePropertyContainer
  • Next by thread: Multiple NSDocuments in a single window
  • Index(es):
    • Date
    • Thread