A general framework for the analysis of phenotypic trajectories in evolutionary studies