Home | Trees | Indices | Help |
---|
|
object --+ | timeline.Timeline --+ | Thing
A basic Thing -- it is a Timeline. This represents a container of other Things. Use add() to add other Things to it. They will appear as per the keys() you supply to this Thing.
If the user supplies a draw() method, then it will be called and that's where you put the cairo commands to do your actual drawing.
If you define a draw() method, it will get called every frame. The signature is: def draw(self,context,frame_number)
Typical use:
class Alien(Thing): def __init__(self,x, speed=1): # up to you ## Now initialize the Thing: You *must* do this. Thing.__init__( self, id="alien")
ends.
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
Instance Variables | |
currentFrame This provides a _Frame instance. |
|
frame Just be aware there is a variable of this name and don't use it. |
|
globalProps This is a Props() object assigned to the entire Thing. |
|
lifespan If you need to start a sequence right after some other thing is done, then get that thing's lifespan and start your thing there. |
|
Inherited from |
Properties | |
Inherited from |
Method Details |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
This will change the layer (z-order) of this thing. Zero is the bottom layer. If you find this is not working, then make sure you give layer numbers, to each thing you add(), that are larger than zero. |
Changes the current key's properties. This is one way to move/scale things around. Usething.changeProps( x=10, y=20 ) BetterUse thing.currentFrame.props.x = 10, it's faster. |
This is used to call functions from frames. Wherever you use ^ it will place a function that you name in the args. NOTEIf you have a jump in the same frame, the function will not get run. You can always avoid a jump; instead have a function that uses goPlay(x). WARNINGMake sure you name the function; not call it. It's easy to make a mistake. Use funcName and not funcName(). If there are arguments then use a tuple like (funcName, arg1,arg2,...) UseTypical use: self.funcs( "........^", somefunc ) self.funcs( "...^", (self.goPlay,10) ) # Here we pass 10 to goPlay. ends. |
Fetch the named properties of a Thing. Usex,y,a = self.getProps("x","y","a") NoteIt's quicker to use: self.currentFrame.props.BLAH, where BLAH is a property like x,y or rot.
|
Tell this Thing to go to a certain frame number(or label) and play. Usething.goPlay(7) thing.goPlay("die") |
Tell this Thing to go to a certain frame number(or label) and stop. Usething.goStop(2) thing.goStop("hide") |
This is used to set jumps to other frames. Wherever you use ^ it will place a jump to a frame that you name (a label or a frame number) in the args. UseTypical use: self.keys ( "#--#----#",...) self.jumps( "........^", "start" ) #look for label 'start' and jump to it. self.jumps( "...^", 1 ) # keep looping back to frame 1. ends.
|
This sets the keys that control the lifespan of Things 1)added to this thing and 2)Whatever you draw(). Key syntax
UseTypical use: #Here we have only one keyframe, hence we need one Props() object. p1 = Props ( x=100, y=20, a=0.5 ) self.keys ( "#=.", p1 ) # If you have more than one keyframe, have a prop for each one: self.keys ( "#---#", Props(), Props(rot=pi * 2) ) #To tween movement do something like this: self.keys( "#----------------------#", Props(x=0), Props(x=100) ) #move from 0 to 100 gradually. ends.
|
This is used to assign labels to frames. Wherever you use ^ it will place a label you name in the args. (The idea is that it points to the frame in the keys() command above it.) UseTypical use: self.keys ( "#---------#.", ...) self.labels( "...........^", "die" ) Later, you can say: self.goPlay('die') ends.
|
Send a thing to its next frame. Kind of untested really... |
Tell this Thing to start playing again. However it was stopped, this will cause it to start again. Usething.play() |
Useful to debug things. Usething.showData() |
Tell this Thing to stop playing. This is different from a stop in a keyframe in that it's not recorded in the key's properties -- so it won't be remembered. Usething.stop() |
This is used to set stops in particular frames. Wherever you use ^ it will place a stop. UseTypical use: self.keys ( "#--------#...",...) self.stops( "...^.....^" ) ends.
|
Instance Variable Details |
currentFrameThis provides a _Frame instance. Within that, the most useful property is 'props'. For example: boat.currentFrame.props.x is the x coord of the boat right now. |
globalPropsThis is a Props() object assigned to the entire Thing. Can be set from the add() method of a Thing (see Timeline class). You can also simply use it in a Thing's init. |
lifespanIf you need to start a sequence right after some other thing is done, then get that thing's lifespan and start your thing there. See Thing.add() for the parentFrame argument. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue May 26 16:03:26 2009 | http://epydoc.sourceforge.net |