1

I want to compose two separate CSS keyframe animations to make an image vibrate and rotate (see http://jsfiddle.net/3zAeZ/). The problem I believe I'm running into is: I'm setting the transform attribute in both keyframe rules, therefore one rule is clobbering the other.

I know this works using top & left instead of translate, but the keyframes rule will be much easier to reuse in the future if I do a transform (for example, in case I ever need to position the image differently).

I'm stumped. Can I do this? Is there a better way I should be doing it?

1 Answer 1

2

You can use multiple transforms like

transform: rotate(1337deg) scale(1.5) translate(6em, 300px);

Now I realize that you need two different animation durations as well. So the best I can come up with is using two elements http://jsfiddle.net/3zAeZ/1/

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, the two different timings are definitely the kink. That seems to be the only way I can think of too. Unfortunately, I can't even clean this up by using a psuedo-element since most browsers don't support animations on psudo-elements. Thanks for the answer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.