I'm looking at: https://support.google.com/webmasters/answer/35769?hl=en#design_and_content_guidelines
And it states "Avoid tricks intended to improve search engine rankings.". It also suggests you make the site primarily for users. I'm not sure if users want to see text change every three seconds.
Also, the contents of the H1 tag are very important to search engines and with luck you'll get listed in search engines for pizza instead of bolongese or pasta. because pizza is what the search engine bots can read. I personally would not use any other tags inside the H1 tag.
If you must provide word animation on your site, you should make images with those words in them to help users understand the meaning. For example, for pizza, show a box of pizza, and for pasta, show spaghetti. Make a carousel formatted design. My bank's website uses a carousel based design where large images change every few seconds with the option to choose an image and to pause the changes: