modified FKanimate and PG.m