well the cannon has to be a doodad because units cannot change their roll/pitch angles
but i dont think there is any way to change this via triggers. the best alternatives (not very good...) i can think of:
1. use a unit (maybe a guard tower i dunno wat ur after) as the gun base, and then have another unit as the barrel tip, and use triggers to periodically refresh a lightning effect between these two units. u can then change the location of the gun tip as u wish using triggers, like moving the unit, or changing the fly height of the gun tip.
2. fairly complicated system, and probably looks just as bad. instead of a lightning effect in the first one, you connect the two using many ball shaped completely black dummy units. the dummy units will have to have their positions adjusted whenever the gun tip is to be moved, and you will have to calculate the arithmetics/formulae for the movement of each of these pieces...
cant think of anything else, if there really is a way to alter pitch and roll via triggers (maybe in JASS, i dont know, i dont JASS) then it would be alot easier that way lol