G4P (GUI for Processing) 4.3.9
A set of GUI controls for your Processing sketch.
Loading...
Searching...
No Matches
g4p_controls.GAnimIcon Class Reference
Inheritance diagram for g4p_controls.GAnimIcon:

Classes

class  AnimClip
 

Public Member Functions

void advanceAnimationFrame (GTimer timer)
 
GAnimIcon animate ()
 
GAnimIcon animate (String id)
 
GAnimIcon copy ()
 
 GAnimIcon (PApplet papp, PImage image, int nbrCols, int nbrRows, int interval)
 
 GAnimIcon (PApplet papp, String fname, int nbrCols, int nbrRows, int interval)
 
GAnimIcon getThis ()
 
void listClips (String title)
 
GAnimIcon setFrame (int fn)
 
GAnimIcon setInterval (int interval)
 
GAnimIcon setInterval (String id, int interval)
 
GAnimIcon start ()
 
GAnimIcon stop ()
 
GAnimIcon storeAnim (String id, int start, int end, int interval)
 
GAnimIcon storeAnim (String id, int start, int end, int interval, int nbrLoops)
 
- Public Member Functions inherited from g4p_controls.GIcon
GIcon copy ()
 
PImage getFrame ()
 
PImage getFrame (int fn)
 
GIcon getThis ()
 
 GIcon (PApplet papp, PImage image, int nbrCols, int nbrRows)
 
 GIcon (PApplet papp, String fname, int nbrCols, int nbrRows)
 
int height ()
 
int width ()
 

Protected Member Functions

 GAnimIcon ()
 
- Protected Member Functions inherited from g4p_controls.GIcon
 GIcon ()
 

Protected Attributes

AnimClip anim_clip = null
 
Map< String, AnimClipclips = new HashMap<String, AnimClip>()
 
GTimer timer
 
- Protected Attributes inherited from g4p_controls.GIcon
PApplet app = null
 
int currFrame = 0
 
int height = 0
 
PImage[] img = null
 
int nbrFrames = 0
 
GAbstractControl owner = null
 
int width = 0
 

Detailed Description

Class for the creation of animated icons to be used with GButton, GLabel, GCheckbox and GOption controls.

All animated icons will have an animation clip called 'ALL' which displays all the frames starting at zero with the user specified frame interval.

Introduced in v4.1

Author
Peter Lager

Constructor & Destructor Documentation

◆ GAnimIcon() [1/3]

g4p_controls.GAnimIcon.GAnimIcon ( )
protected

This constructor is not to be used.

◆ GAnimIcon() [2/3]

g4p_controls.GAnimIcon.GAnimIcon ( PApplet  papp,
String  fname,
int  nbrCols,
int  nbrRows,
int  interval 
)

Create an animated icon

Parameters
pappthe PApplet object that will be used to display this icon
fnamethe name of the file containing the tiled image.
nbrColsnumber of horizontal tiles
nbrRowsnumber of vertical tiles
intervalthe time between displaying frames in milliseconds

◆ GAnimIcon() [3/3]

g4p_controls.GAnimIcon.GAnimIcon ( PApplet  papp,
PImage  image,
int  nbrCols,
int  nbrRows,
int  interval 
)

Create an animated icon

Parameters
pappthe PApplet object that will be used to display this icon
imagethe tiled image containing the frames
nbrColsnumber of horizontal tiles
nbrRowsnumber of vertical tiles
intervalthe time between displaying frames in milliseconds

Member Function Documentation

◆ advanceAnimationFrame()

void g4p_controls.GAnimIcon.advanceAnimationFrame ( GTimer  timer)

Required by GTimer to advance frame

Parameters
timerthe associated timer

◆ animate() [1/2]

GAnimIcon g4p_controls.GAnimIcon.animate ( )

Animate the entire sequence.

Returns
the icon being animated

◆ animate() [2/2]

GAnimIcon g4p_controls.GAnimIcon.animate ( String  id)

Animate the icon using store clip details but use the specified frame interval instead of the stored value.
You can also decide on the number of times the clip is to be shown.

Parameters
idthe unique id for the clip
Returns
the icon being animated

◆ copy()

GAnimIcon g4p_controls.GAnimIcon.copy ( )

Returns a copy of this animated icon to be used with another control.
Note: animated icons must only be used with one second control. Use copy() to get a duplicate icon which can be used with another control.

Returns
a copy of this icon

Reimplemented from g4p_controls.GIcon.

◆ getThis()

GAnimIcon g4p_controls.GAnimIcon.getThis ( )
Returns
returns this animated icon.

Reimplemented from g4p_controls.GIcon.

◆ listClips()

void g4p_controls.GAnimIcon.listClips ( String  title)

Display a list of animation clips for this icon

Parameters
titletitle for this list

◆ setFrame()

GAnimIcon g4p_controls.GAnimIcon.setFrame ( int  fn)

Set the current frame to be displayed. The supplied frame number will be constrained to a valid value.
This is ignored if the animation clip is running.

Parameters
fnthe frame number to display.
Returns
this icon

Reimplemented from g4p_controls.GIcon.

◆ setInterval() [1/2]

GAnimIcon g4p_controls.GAnimIcon.setInterval ( int  interval)

Change the interval between frames for the current animation clip.

Parameters
intervalthe time between frames in milliseconds
Returns
this icon

◆ setInterval() [2/2]

GAnimIcon g4p_controls.GAnimIcon.setInterval ( String  id,
int  interval 
)

Change the interval between frames for the animation clip with specified id.

Parameters
idthe animation id
intervalthe time between frames in milliseconds
Returns
this icon

◆ start()

GAnimIcon g4p_controls.GAnimIcon.start ( )

Resume an animation that has previously been stopped with stop()

Returns
this icon

◆ stop()

GAnimIcon g4p_controls.GAnimIcon.stop ( )

Stop the current animation. The animation can be resumed with start()

Returns
this icon

◆ storeAnim() [1/2]

GAnimIcon g4p_controls.GAnimIcon.storeAnim ( String  id,
int  start,
int  end,
int  interval 
)

Store details of an animation sequence for later use.

Parameters
idunique id for this animation clip
startfirst frame for this clip
endlast frame for this clip
intervalthe time (ms) between frames
Returns
the icon being stored

◆ storeAnim() [2/2]

GAnimIcon g4p_controls.GAnimIcon.storeAnim ( String  id,
int  start,
int  end,
int  interval,
int  nbrLoops 
)

Store details of an animation sequence for later use.

Parameters
idunique id for this animation clip
startfirst frame for this clip
endlast frame for this clip
intervalthe time (ms) between frames
nbrLoopsthe number of times this clip is played, (0 = play forever)
Returns
the icon being stored