Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

GIF form

Hi Guys,

I want to turn my gif into a form for a newsletter, the animation is an envelope which pops open with a piece of paper, it then closes and a sent stamp appears on it. I want to get the gif to stop at the point the paper pops up and allow visitors to the site to put in their details press send then get the gif to reanimate with the paper going back into the envelope. Can anyone suggest a way I could do this or if it's possible?

Is this for an email or a page on a website?

3 Answers

Thanks so much Luke! You are amazing. Unfortunately I already paid an animator to do gif so I can't do the animation in SVG. But thank again for your help.

HI Luke,

Thanks for helping me, it's for a website.

Phew, I was worried for a second you were going to say it was for an email which would have been a difficult situation. Yes there are several javascript frameworks that exist which can pause gifs such as:

http://rubentd.com/gifplayer/

https://github.com/ctrl-freaks/freezeframe.js/

https://github.com/krasimir/gifffer

The biggest challenge you'll face is timing the gif perfect, and it might be too much trouble to go that route. Have you considered using an SVG or a sprited image to achieve the same effect? Here are some examples from a codepen search http://codepen.io/search?q=Envelope&limit=all&depth=everything&show_forks=false :

http://codepen.io/peiche/pen/ifhwq

http://codepen.io/hans/pen/EFaGk