Help implementing basic spinner animation

  • dfeinberg5-1303570509513883658

    Danny

    4 months ago

    I'd like to implement a basic loading spinner animation. This could look something like this in css:
    <style>
    .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    }

    @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
    }
    </style>


    The custom CSS field in the editor doesn't seem to support adding keyframes. I see the animationstart, animationend, etc in the events panel, but where can I actually define the animation?

    Thanks for any help!
  • Tod-1303570510906523699

    Tod

    4 months ago

    Great energy @Danny! Your continuous contribution to the toddle Community just made you advance to Community Level 3!
  • lucasg-1303592300609277972

    Lucas G

    4 months ago

    Keyframes are 'at-rules' which are defined at a global scope in a stylesheet, not at the 'element level', so they will not work if you just paste them into the CSS box
  • You can either put them in the header or in a <style> element
    πŸ™Œ1
  • jacobkofoed-1303636524272975953

    Jacob Kofoed

    4 months ago

    toddle will eventually support a visual keyframe animator, but we want to make sure we get it right, so it will likely be a while.

    For now, you can do what Lucas said. You can even just paste the HTML you quoted directly into a component. It should add the style-tag automatically.
    πŸ‘2
  • dfeinberg5-1303722913324863529

    Danny

    4 months ago

    Thank you both!!
  • dfeinberg5-1303723180094918736

    Danny

    4 months ago

    Yeah, i can imagine adding some kind of native animation tool would be quite a project to do it well. Definitely not a high priority for me.

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.