Forums

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

Home Forums CSS Cleaning up code on css lotus

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #36847
    jgessentials
    Member

    Hi
    I am trying to add a pulse to the petals on hover but there is a “transform” conflict.
    To show up properly the petals all already have a rotate(x deg)
    The keyframes pulse works for the first petal with the added rotate(x deg) but the others obviously don’t work.
    Any ideas how to go about this to make it work?

    http://dabblet.com/gist/1911700

    Thank you for any ideas you might have

    #97500
    jgessentials
    Member

    will do thank you :)

    #97502
    Schot
    Member

    Tada!
    http://dabblet.com/gist/1914694 *use chrome*

    Used only chrome webkit to simplify debugging. You just needed to make unique keyframes for each petal to get around the rotation problem. :)

    @-webkit-keyframes detoxpulse {
    0% { -webkit-transform: scale(1) rotate(45deg); }
    80% { -webkit-transform: scale(1.05) rotate(45deg); }
    100% { -webkit-transform: scale(1) rotate(45deg);}
    }

    @-webkit-keyframes dietpulse {
    0% { -webkit-transform: scale(1) rotate(90deg); }
    80% { -webkit-transform: scale(1.05) rotate(90deg); }
    100% { -webkit-transform: scale(1) rotate(90deg);}
    }

    @-webkit-keyframes hairpulse {
    0% { -webkit-transform: scale(1) rotate(135deg); }
    80% { -webkit-transform: scale(1.05) rotate(135deg); }
    100% { -webkit-transform: scale(1) rotate(135deg);}
    }

    @-webkit-keyframes nutrientspulse {
    0% { -webkit-transform: scale(1) rotate(180deg); }
    80% { -webkit-transform: scale(1.05) rotate(180deg); }
    100% { -webkit-transform: scale(1) rotate(180deg);}
    }

    @-webkit-keyframes lifestylepulse {
    0% { -webkit-transform: scale(1) rotate(225deg); }
    80% { -webkit-transform: scale(1.05) rotate(225deg); }
    100% { -webkit-transform: scale(1) rotate(225deg);}
    }


    .lotus {padding: 300px 100px;}
    .petal { position: absolute;
    -webkit-border-radius: 165px 10px 165px 10px;
    -webkit-transform-origin: 100% 0;
    height: 200px;
    width: 200px;
    opacity:0.84; }
    .detox { background: #ff3399; -webkit-transform: rotate(45deg); }
    .detox:hover { opacity:1; z-index:+1; -webkit-animation: detoxpulse .4s ease-in; }

    .diet { background: #ffac40; -webkit-transform: rotate(90deg); }
    .diet:hover {opacity:1;z-index:+1;-webkit-animation: dietpulse .4s ease-in;}

    .hair {background: #ffff00;-webkit-transform: rotate(135deg);}
    .hair:hover {opacity:1;z-index:+1;-webkit-animation: hairpulse .4s ease-in;}

    .nutrients {background: #70c92a;-webkit-transform: rotate(180deg);}
    .nutrients:hover {opacity:1;z-index:+1;-webkit-animation: nutrientspulse .4s ease-in;}

    .lifestyle {background: #6ac5f1;-webkit-transform: rotate(225deg);}
    .lifestyle:hover {opacity:1;z-index:+1;-webkit-animation: lifestylepulse .4s ease-in;}
    #97520
    jgessentials
    Member

    Excellent work! I actually just finished and did the exact same thing as you, that is nice validation for me thank you!
    Now I have to add text inside the petals…another interesting challenge. Thank you!

    #97522
    jgessentials
    Member

    you mean line height the same as the petal height:200px?

    #97527
    jgessentials
    Member

    nice, got it. Now how can I add rotate to the text as well to get it lined up the way I would like?
    Right now I have this:


    .labels {
    line-height:200px;
    text-align:center;
    color:#ffffff;
    font-size:18px;
    font-family: 'Inika', serif;
    }



    Do I need to define keyframes for labels as well?

    #97530
    Schot
    Member

    i think unique classes for each petal span might do it.

    Fun project btw!

    #97535
    jgessentials
    Member

    Glad you are enjoying this. So none of this works in IE does it?
    I am getting weird results.

    http://healingaia.com/lotus-test.php
    #97536
    Schot
    Member

    Ah, here we go. Replace span with div so you can apply webkit etc. and then create unique classes for each petal using negative rotate numbers to negate parent rotate values.

    http://dabblet.com/gist/1919152


    DETOXIFICATION


    .detoxlabel {
    -webkit-transform: rotate(-225deg);
    line-height:200px;
    text-align:center;
    color:#ffffff;
    font-size:18px;
    font-family: 'Inika', serif;
    }

    P.s.
    Yes, broken in IE and FF.

    #97540
    jgessentials
    Member

    Excellent thank you so much for your help.

    #97543
    jgessentials
    Member

    So here is the final result: (A special Thank you to Schot & karlpcrowley for their help and patience)

    http://healingaia.com/lotus-test.php

    Now for the big challenge :)
    How can I make this work on IE and FF?
    Should I have gone with jquery?

    #97544

    Here is the support table for CSS animation: http://caniuse.com/#search=css3%20animation

    jQuery would be the way to go if you need a wider range of supported browsers.

    #97545
    jgessentials
    Member

    wow I know very little about jquery but would really like this to be visible on all browsers. Any suggestions in terms of resources or places I can find help?
    Thank you so much

    #97555
    jgessentials
    Member

    Will definitely start working with that thank you!
    I think I might need to place the petals using jquery as well as they aren’t even showing up right in IE.

    #97630
    jgessentials
    Member

    Got this to work nicely.
    http://jsfiddle.net/QJFYJ/48/
    I might have to use images instead of the css setup for the petals so it can be fully cross browser.
    Do you know how to position images using jquery?
    Maybe I should take this to the javascript forum now :)

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