Вопрос

I've built a custom control in Cocoa which is drawn using an NSBezierPath and I'd like it to change shape when it's state has changed (unused state = a pointed 'look here' edge, used state = standard control edge).

It feels like I've looked through every mention of "NSBezierPath" and "Animation" there is on the web but with no luck.

Before I crack out some NSTimers and write my own timing & path point controls, does anyone know if this is possible using Core Animation or similar?

Это было полезно?

Решение

You could use NSAnimation. Create your own NSAnimation subclass, and override setCurrentProgress method. In that method, you can change your NSBezierPath size, shape or whatever you need, based on current animation progress. After that you can force a redraw in the view (via delegate, for instance) to re-display the path.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top