☀️

Creating Sun and Moon Toggle in Figma

Aug 3, 2024

Sun and Moon Toggle with Hover Effect in Figma

Introduction

  • Tutorial on creating a sun and moon toggle with a hover effect in Figma.

Setting Up the Frame

  • Open a new document.
  • Create a frame with dimensions 369x145.
  • Round corners to 200.

Creating the Sun

  • Draw a circle (O on keyboard) with dimensions 120x120.
  • Position it inside the frame and name it "sun".
  • Set frame background to blue and circle (ellipse) to yellow.
  • Add highlights for a 3D effect:
    • Inner Shadow: White highlight, adjust opacity, and color to more yellow.
    • Inner Shadow (bottom): Add shadow from the bottom.

Adding Sun Rays

  • Put the ellipse into a frame, name it "sun and moon".
  • Use circle tool to create rays:
    • Change color to white, adjust opacity to 10.
    • Use Command D to duplicate and adjust size using Option and Shift for centered scaling.
  • Group rays together (Command G) and name it "Ray".

Creating Clouds

  • Use ellipse tool to create clouds:
    • Adjust color to a bluish white.
    • Option drag to create multiple circles inside the frame.
  • Select all cloud pieces, unify (Union Selection), and name it "clouds".
  • Position clouds behind the sun and moon frame.

Creating the Back Cloud Layer

  • Duplicate cloud layer (Command D), push up, and rename to "Cloud Back".
  • Change opacity to 60 and adjust size.

Adding Inner Shadows and Effects

  • Close the frame and apply inner shadows:
    • Keep shadows black, adjust blur.
    • Add drop shadows for highlight effect.
  • Adjust settings for depth on the sun using drop shadows.

Creating the Moon

  • Duplicate the sun (Option drag) and rename it to "moon".
  • Adjust colors to gray, and set shadows to darker.
  • Add moon spots using circle tool:
    • Change color to darker gray and apply inner shadow effect.
    • Group spots and rename to "spot", then group with moon.

Final Adjustments

  • Adjust moon position and settings for roundness and x/y values.
  • Change background color to darker tone.

Adding Stars

  • Use plugins (Icon Duck) to add stars:
    • Drag out star, change color to white, and scatter around the design.
  • Group stars together (Command G) and position under sun and moon frame.

Animation Setup

  • Duplicate layers for hover effect:
    • Adjust positions using x/y values for sun and moon hover states.
  • Create components and set up prototypes:
    • Link sun to hover frame and set easing duration to 300 ms.
    • Link moon to sun on-click with smart animate at 2000 ms.
  • Finalize by dragging in components and testing animation.

Conclusion

  • Encourage viewers to like and subscribe for more tutorials.