Package Things :: Module ThingObjects :: Class FollowThing
[frames] | no frames]

Class FollowThing

       object --+        
                |        
timeline.Timeline --+    
                    |    
                Thing --+
                        |
                       FollowThing

In a FollowThing, you provide a path drawing function and then whatever you add to this Thing will follow that path.

Use

Typical use:

 class FollowPath(FollowThing):
         def __init__(self ):
                 FollowThing.__init__(self)
                 self.keys  (40, self.path)
                 self.dot = Dot() # This will follow the path!
                 self.add(self.dot)
         def path(self,ctx):
             ## This is where you draw the path.
                 ## Here we use a path id taken from an Inkscape SVG file.
                 ## However, you can also use the normal pyCairo drawing commands
                 ## and construct a path in any way you like.
                 ## Simply remember -- do not stroke or fill the path!
                 bos["foll:swoopy"].draw(ctx)

.

Notes

There is no notion (yet) of orienting the thing that follows (the path) to the path itself. The maths is over my head! Waaay over.

Instance Methods
 
keys(self, numFrames, pathFunc, startAtFirstNode=True)
This keys() method is slightly different to the normal one.

Inherited from Thing: __init__, __len__, changeLayer, changeProps, funcs, getProps, goPlay, goStop, jumps, labels, loop, nextFrame, play, showData, stop, stops, toTop

Inherited from timeline.Timeline: add

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables

Inherited from Thing: currentFrame, frame, globalProps, lifespan

Inherited from timeline.Timeline: parentThing

Properties

Inherited from object: __class__

Method Details

keys(self, numFrames, pathFunc, startAtFirstNode=True)

 

This keys() method is slightly different to the normal one.

Parameters:
  • numFrames - Use a number greater than zero. This is the 'smoothness' of the follow animation. You might get an error related to the path and it's number of nodes. Try increasing the numFrames, as this code is still not working properly. In fact, I could do with major help in this dept.
  • pathFunc - Supply a function which can be called where you draw a path.
  • startAtFirstNode - True starts at one end of the path, False at the other.
Overrides: Thing.keys