ftp.nice.ch/pub/next/science/chemistry/BeakerBoy.0.31.s.tar.gz#/BeakerBoy.0.31.s/Info.subproj/BBImageAnimator.h

This is BBImageAnimator.h in view mode; [Download] [Up]

/* BBImageAnimator.h				 
 *
 * This produces some nice Animations. Switching the images inside a
 * button object.
 *
 * Usage: All you have to do is to create a nib with a matrix of all the
 *		  images. Every button inside the matrix contains a certain image
 *  	  and a tag. The tag represents the frame number, ranging form 
 *		  1...to...frames.
 * 		  Type the number of frames into a TextField and connect it to the
 *		  appropriate outlet within the animator object.
 * 		  Do the same with the framesPerSecond and Bouncing flag (1=bounceIt)
 * 		  The last step is to set the target button (with IB or by code)
 *
 * Hints: Normaly the controller should also register as the animators delegate
 *		  to get informed when the animation stops.
 *
 * Credits: The timed-entry part is from the nice Garfinkel-Mahoney Book.
 * 			Used with no permission. Sorry.
 *
 * Written by: 		Thomas Engel
 * Created:    		28.10.1993 (Copyleft)
 * Last modified: 	07.05.1994
 */

#import <appkit/appkit.h>

@interface BBImageAnimator:Object
{
	id		delegate;
	
    id		bounceSettingField;
    id		frameCountSettingField;
    id		sourceImageMatrix;
    id		speedSettingField;
    id		targetButton;

	DPSTimedEntry	animateTE;
	
	int		frameCount;			
	double	frameDelay;
	BOOL	bounceAnimation;		
	BOOL	bouncing;					
	int		currentFrame;		
}

// Some init-methods used for startup-settings. With this it is possible to 
// catch the right time where the objects get referenced. It also enables one
// to split the animation into different nibs.

- setDelegate:anObject;
- setTargetButton:aButton;
- setBounceSettingField:aTextField;
- setFrameCountSettingField:aTextField;
- setSpeedSettingField:aTextField;

// This starts the animation and stops it. It triggers a timed entry.
// Normaly a animation stops itself after finishing but
// remember to stop the animation when the window closes! After the animation
// has stopped the delegate will recieve a animationDidStop:sender msg.
// The start aniamtion is a action-method to have it easier with IB.

- startAnimation:sender;
- stopAnimation;
- switchToNextFrame;

@end

@interface Object(BBImageAnimatorDelegate)

- animationDidStop:sender;

@end

/*
 * History: 07.05.94 Changed some names .
 *
 *			19.01.94 Changed the delegate method declaration.
 *
 *			29.10.93 Switched to the startAnim./stopAnim methods to support
 *					 the DSPtimedEntry.
 *					 Included a delegated method animationDidStop to
 *					 ensure some cleanups after the anim.
 *
 *          28.10.93 First got it up and running
 *         
 *
 * Bugs: - had not time for coding bugs :-)
 */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.