Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS I need a Jedi to help with placement of CSS3 transition

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #36402

    I am trying to create a light saber. You will see the problem when you hover over it.
    I would like the bottom of it to stay stationary while the end of it extends.
    I know things are more complicated because it is rotated.
    http://jsfiddle.net/aaronheine/L4Epe/

    Thanks and may the force be with you.

    #95717
    jamygolden
    Member

    That’s happening because of the way rotate works. Hover over the box: http://jsfiddle.net/L4Epe/25/
    Rotate is animating because of the ‘all’ set on the transition property.

    I’ve also done a lightsaber CSS ‘experiment’. http://css-plus.com/examples/2011/06/css-lightsabers/
    May the force be with you.

    #95718

    I have tried that. When I change “all” to just “width” nothing happens.

    #95719
    jamygolden
    Member

    Yeah, I’m saying that you can’t do it the way you want to do it. The change in width changes the position of the element due to the rotation (and then you ‘un-hover’).

    You’re going to have to have the element contain the final width if you want hover + rotate to work together.

    #95741

    Ah, you simply need to add transform-origin: 0 0; (with prefixes).

    #95764
    jamygolden
    Member

    Oh really? Nice one – I haven’t used that property before.

    #95766

    @jamy_za It’s a pretty handy property.

    #95799

    That got it, thanks!

    #95858

    No worries mate.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.