Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I began on QTMovieLayer, but being less powerfull (of course) than QTMovieView it opened another box of issues. The solution was to use NSAnimation on the QTMovieView. I have a NSAnimation class looking somewhat like this:</p> <p><strong>AlphaAnimation.h</strong></p> <pre><code> #import &lt;Cocoa/Cocoa.h&gt; NSString * const AAFadeIn; NSString * const AAFadeOut; @interface AlphaAnimation : NSAnimation { NSView *animatedObject; NSString *effect; } - (id)initWithDuration:(NSTimeInterval)duration effect:(NSString *)effect object:(NSView *)object; @end </code></pre> <p><strong>AlphaAnimation.m</strong></p> <pre><code> #import "AlphaAnimation.h" NSString * const AAFadeIn = @"AAFadeIn"; NSString * const AAFadeOut = @"AAFadeOut"; @implementation AlphaAnimation - (id)initWithDuration:(NSTimeInterval)aDuration effect:(NSString *)anEffect object:(NSView *)anObject { self = [super initWithDuration:aDuration animationCurve:0]; if (self) { animatedObject = anObject; effect = anEffect; } return self; } - (void)setCurrentProgress:(NSAnimationProgress)progress { if ([effect isEqual:AAFadeIn]) [animatedObject setAlphaValue:progress]; else [animatedObject setAlphaValue:1 - progress]; } @end </code></pre> <p>Which can then be used like this:</p> <pre><code>animation = [[AlphaAnimation alloc] initWithDuration:0.5 effect:AAFadeIn object:movieView]; [animation setAnimationBlockingMode:NSAnimationNonblocking]; [animation startAnimation]; </code></pre> <p>If your QTMovieViews are in full screen it isn't very smooth, though.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload