Help me I'm a python noob

Hi to all,
Iv’e recently dabbled with Partick Boelens Audiovisualizer tutorial on Blender Cookie, and I now have a taste for learning more python.
I do have a basic knowledge of OOP.

What I want to do is get some fundamentals behind controlling objects dynamically created using python.

What I’m currently trying to achieve is to replicate the classic macromedia circle pre-loader animation that fades.

Currently I can:
place a circle in the 3d view port and move along Y axis by 2 blender units
get the cursor location and set it the same as my circle origin
reset cursor location to (0,0,0)
move objects geometry_origin location to the cursor location.

in top view in 3d scene ## if I hit r for rotate and move the mouse, the circle spins around the centre / cursor_location which is what I want.

what I cant figure out is how to make the circle spin constantly using code.

Q: is it possible to drive the rotation via a speed variable? as this seems the simplest way for e.g:
speed =3;
bpy.context.active_object.rotation.z += speed;
(yes i know this wouldn’t work its an example)

or must the animation be driven by a something else like an fcurve.
would the rotations be linked to the keyframes:
@24fps 360/24 = 15 so each frame rotates the circle by a total of 15 degrees and a full second would rotate a complete 360

Any examples or help on this would be great.


Generate a circle in the origin
In the time-line activate the red button (to automatically) create key-frames.
Set in the second field to the right from this button LocRot
Type key-i at time 1
goto time 31 e.g. and rotate your circle (R X 90 or what you like)
Set the end-time
play the animation.

The Python commands are in the info window: search above with the mouse the double arrow and open that window! to see the commands you did

bpy.ops.transform.rotate(value=(-0.0813765,), axis=(-1, -2.22045e-016, -4.93038e-032), constraint_axis=(False, False, False), constraint_orientation=‘GLOBAL’, mirror=False, proportional=‘DISABLED’, proportional_edit_falloff=‘SMOOTH’, proportional_size=1, snap=False, snap_target=‘CLOSEST’, snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
(which could be shortend a lot, because of default values) :evilgrin: