CSS animation circle-triangle-square











up vote
1
down vote

favorite












I'm toying around with CSS animations for fun. My limited experience is getting in the way.



The script below transforms a circle to triangle to an square and reverses. The animation between circle and triangle however has a slight bug. I expect it has something to do with the border but I can't seem to fix it. (I have no background in programming..:))



Could someone give me a push in the right direction?



.triangle {
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-color: transparent;
animation-name: testframe;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

@keyframes testframe {
/*circle*/
0% {
width: 100px;
height: 100px;
background-color: #6980fe;
border-radius: 50%;
}
/*trianle*/
50% {
width: 0;
height: 0;
border: 0 solid transparent;
border-right-width: 50px;
border-left-width: 50px;
border-bottom: 100px solid #6980fe;
background-color: transparent;
}
/*square*/
100% {
width: 100px;
height: 100px;
background-color: #6980fe;
}
}









share|improve this question
























  • If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
    – Andrew Bone
    Nov 9 at 14:00















up vote
1
down vote

favorite












I'm toying around with CSS animations for fun. My limited experience is getting in the way.



The script below transforms a circle to triangle to an square and reverses. The animation between circle and triangle however has a slight bug. I expect it has something to do with the border but I can't seem to fix it. (I have no background in programming..:))



Could someone give me a push in the right direction?



.triangle {
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-color: transparent;
animation-name: testframe;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

@keyframes testframe {
/*circle*/
0% {
width: 100px;
height: 100px;
background-color: #6980fe;
border-radius: 50%;
}
/*trianle*/
50% {
width: 0;
height: 0;
border: 0 solid transparent;
border-right-width: 50px;
border-left-width: 50px;
border-bottom: 100px solid #6980fe;
background-color: transparent;
}
/*square*/
100% {
width: 100px;
height: 100px;
background-color: #6980fe;
}
}









share|improve this question
























  • If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
    – Andrew Bone
    Nov 9 at 14:00













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm toying around with CSS animations for fun. My limited experience is getting in the way.



The script below transforms a circle to triangle to an square and reverses. The animation between circle and triangle however has a slight bug. I expect it has something to do with the border but I can't seem to fix it. (I have no background in programming..:))



Could someone give me a push in the right direction?



.triangle {
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-color: transparent;
animation-name: testframe;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

@keyframes testframe {
/*circle*/
0% {
width: 100px;
height: 100px;
background-color: #6980fe;
border-radius: 50%;
}
/*trianle*/
50% {
width: 0;
height: 0;
border: 0 solid transparent;
border-right-width: 50px;
border-left-width: 50px;
border-bottom: 100px solid #6980fe;
background-color: transparent;
}
/*square*/
100% {
width: 100px;
height: 100px;
background-color: #6980fe;
}
}









share|improve this question















I'm toying around with CSS animations for fun. My limited experience is getting in the way.



The script below transforms a circle to triangle to an square and reverses. The animation between circle and triangle however has a slight bug. I expect it has something to do with the border but I can't seem to fix it. (I have no background in programming..:))



Could someone give me a push in the right direction?



.triangle {
display: inline-block;
width: 0;
height: 0;
border-style: solid;
border-color: transparent;
animation-name: testframe;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

@keyframes testframe {
/*circle*/
0% {
width: 100px;
height: 100px;
background-color: #6980fe;
border-radius: 50%;
}
/*trianle*/
50% {
width: 0;
height: 0;
border: 0 solid transparent;
border-right-width: 50px;
border-left-width: 50px;
border-bottom: 100px solid #6980fe;
background-color: transparent;
}
/*square*/
100% {
width: 100px;
height: 100px;
background-color: #6980fe;
}
}






css






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 13:02

























asked Nov 9 at 12:54









Sumerechny

263




263












  • If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
    – Andrew Bone
    Nov 9 at 14:00


















  • If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
    – Andrew Bone
    Nov 9 at 14:00
















If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
– Andrew Bone
Nov 9 at 14:00




If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation.
– Andrew Bone
Nov 9 at 14:00












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










for to fix this slight bug, you shoud to include this property in triangle animation:



"border-radius: 0;"



like this:



...

/*trianle*/
50% {
width: 0;
height: 0;
border: 0 solid transparent;
border-radius: 0;
border-right-width: 50px;
border-left-width: 50px;
border-bottom: 100px solid #6980fe;
background-color: transparent;
}

...


I hope help you.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226097%2fcss-animation-circle-triangle-square%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    for to fix this slight bug, you shoud to include this property in triangle animation:



    "border-radius: 0;"



    like this:



    ...

    /*trianle*/
    50% {
    width: 0;
    height: 0;
    border: 0 solid transparent;
    border-radius: 0;
    border-right-width: 50px;
    border-left-width: 50px;
    border-bottom: 100px solid #6980fe;
    background-color: transparent;
    }

    ...


    I hope help you.






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      for to fix this slight bug, you shoud to include this property in triangle animation:



      "border-radius: 0;"



      like this:



      ...

      /*trianle*/
      50% {
      width: 0;
      height: 0;
      border: 0 solid transparent;
      border-radius: 0;
      border-right-width: 50px;
      border-left-width: 50px;
      border-bottom: 100px solid #6980fe;
      background-color: transparent;
      }

      ...


      I hope help you.






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        for to fix this slight bug, you shoud to include this property in triangle animation:



        "border-radius: 0;"



        like this:



        ...

        /*trianle*/
        50% {
        width: 0;
        height: 0;
        border: 0 solid transparent;
        border-radius: 0;
        border-right-width: 50px;
        border-left-width: 50px;
        border-bottom: 100px solid #6980fe;
        background-color: transparent;
        }

        ...


        I hope help you.






        share|improve this answer












        for to fix this slight bug, you shoud to include this property in triangle animation:



        "border-radius: 0;"



        like this:



        ...

        /*trianle*/
        50% {
        width: 0;
        height: 0;
        border: 0 solid transparent;
        border-radius: 0;
        border-right-width: 50px;
        border-left-width: 50px;
        border-bottom: 100px solid #6980fe;
        background-color: transparent;
        }

        ...


        I hope help you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 13:38









        MarcusVinnicius

        1163




        1163






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53226097%2fcss-animation-circle-triangle-square%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Schultheiß

            Android Play Services Check

            Where to put API Key in Google Cloud Vision for PHP