Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
i have a view with "Wants Core Animation Layer" checked in IB, and i'm trying to animate between the colors set by the IBActions:

Code:
- (IBAction)backgroundBlack:(id)sender
	{
	[[self animator] setBackgroundColors:[NSArray arrayWithObjects:[NSColor blackColor], nil]];
	}

- (IBAction)backgroundWhite:(id)sender
	{
	[[self animator] setBackgroundColors:[NSArray arrayWithObjects:[NSColor whiteColor], nil]];
	}

the view switches colors, but it doesn't animate (EX: Preview > Preferences > General > Window Background)

coding [self animator] setFrame: is the way i make my window resize with CA, so is this not the same with [self animator] setBackgroundColors:?
 

kpua

macrumors 6502
Jul 25, 2006
294
0
The animator proxy is only able to create implicit animations for a few properties like frame size/origin, opacity, rotation, and so on.

"backgroundColors" is a special property of NSCollectionView and therefore not animatable by the animator by default. Don't quote me on this, but you might be able to set up a custom property animation for this... I know there is support for custom property animations, but I'm not sure where to begin implementing it.

Also, just because Preview animates its background color, that doesn't mean they use -animator to do it, or even use Cocoa at all. They're probably modifying the layer's property directly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.