Posted in Animations
7120
7:09 am, October 1, 2021

Sun Reflection CSS and HTML Only

What is Sun Reflection CSS and HTML Only?

This is a sun with an animated reflection done using css and html only

What can i use this for?

This could be modified to add some interest to a logo, or other image or element on your web page. 

Should I use Sun Reflection?

This is more of an example of what can be done using just html and css for animation effects, but you could use it carefully in your project. 

Conclusion

Sun Reflection is a nice example showing what can be done using animation techniques with no need for bulky animation libraries or excessive (any) javascript. 

Original Codepen Source

Thanks to the author Pokecoder, this code comes from the Sun Reflection pen on Codepen.

Sun Reflection CSS and HTML Only Demo

View Demo Full Screen View Demo New Tab

Sun Reflection CSS and HTML Only Code

HTML

<div class="sun-wrap">
<div class="sun">
  <div class="water">
    <div class="reflection"></div>
  </div>
</div>
  <div class="plop"></div>
</div>

CSS

.sun-wrap {
  height: 100vh;
  width: 100vw;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sun {
  background: linear-gradient(174deg, rgba(255,0,0,1) 44%, rgba(255,123,0,1) 63%);
  height: 50vmin;
  width: 50vmin;
  margin-left: 25vmin;
  border-radius: 50%;
  box-shadow: 
    0 -0.5vmin 4vmin red;
  display: flex;
  align-items: center;
  justify-content: center;
} 

.water {
  position: relative;
  background: black;
  width: 80vmin;
  height: 25vmin;
  top: 26vmin;
  display: flex;
  align-items: center;
  justify-content: center;
  }

.reflection {
  position: relative;
  background: rgba(255,123,0,1);
  color: rgba(255,123,0,1);
  width: 50vmin;
  height: 3vmin;
  border-radius: 50%;
  top: -12vmin;
  box-shadow: 
    0.5vmin 0 2vmin,
    -0.5vmin 0 2vmin;
  animation: fade 3s ease-in-out infinite;
}

.reflection::after {
  content: '';
  position: absolute;
  background: rgba(255,123,0,1);
  color: rgba(255,123,0,1);
  width: 50vmin;
  height: 5vmin;
  border-radius: 50% 90% 50% 80%;
  top: 2.5vmin;
  box-shadow: 
    0.5vmin 0 2vmin,
    -0.5vmin 0 2vmin;
}

.reflection::before {
  content: '';
  position: absolute;
  background: rgba(255,123,0,1);
  color: rgba(255,123,0,1);
  width: 40vmin;
  height: 5vmin;
  left: 5vmin;
  border-radius: 50% 90% 50% 80%;
  top: 7vmin;
  box-shadow: 
    0.5vmin 0 2vmin,
    -0.5vmin 0 2vmin;
  animation: tide 3s ease-out infinite;
}

.plop {
  background: rgba(255,123,0,1);
  color: rgba(255,123,0,1);
  position: relative;
  height: 10vmin;
  width: 30vmin;
  border-radius: 40% 80% 50% 70%;
  left: -38vmin;
  top: 25vmin;
  box-shadow: 
    0.5vmin 0 2vmin,
    -0.5vmin 0 2vmin;
  animation: popout 3s ease-out infinite;
}

@keyframes fade {
  50% {
    transform: translatey(-0.5vmin) scaley(0.7);
  }
}

@keyframes tide {
  25% {
    transform: translatey(0.3vmin) scale(1, 1.2);
  }
  50% {
    transform: translatey(0.5vmin) scale(1.1., 1.2);
  }
  100% {
    transform: translatey(-1vmin) scale(0.7, 1.3);
  }
}

@keyframes popout {
  25% {
    transform: translate(0.5vmin, 0.5vmin) scalex(0.8);
  }
  50% {
    transform: translate(1vmin, 1vmin) scalex(0.6);
  }
  100% {
    transform: translate(2vmin, 3vmin) scalex(0.3);
    height: 0vmin;
    
  }
}

External Link for Sun Reflection CSS and HTML Only

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome to CSSBundle.com

Hi there and welcome to CSSBundle. Here at CSS Bundle we aim to find the best css and javascript bundles and demos and add them here to make them easy to find all in one place.

If you would like to stay up to date with our latest updates you can subscribe to our mailing list where we will send you one email per week with the latest updates, no spam emails just the latest updates.

Random Quote


Latest Code
css animations Falling Stars CSS Animation html Video different sources on screen sizes video embed html responsive css animations Animated Triangles on Canvas JS HTML HTML Canvas Instant colour fill with HTML Canvas javascript Transform Text into Images using SnapText JS CSS Tools Fancy Border Radius CSS Generator Tool - spin animation keyframes CSS Tools CSS Drop Filter Shadow Creator CSS Slider A CSS and HTML Only Carousel Slider CSS Z-Index Z-Index Code Front - CSS to change z-index when element is active sections section with image to the right text to the left gradient Sections Two Clickable Logo Promo Box Section Foundation HTML CSS Sections Inline Contact Form Formatting HTML CSS Sections Overview full width section in Poppins font with light gray background using foundation Interactive Images Map Image with Easy Dots and Titles using only CSS HTML Sections Social Header Links easy Drop in Code with Font Awesome Icons Sections Responsive Friendly Subscribe to our Newsletter Section CSS Tips Create a button with CSS, HTML and Center it! CSS Text Formatting Truncate Text to an amount of lines using line-clamp CSS Positions Item Positioning in CSS CSS Tips Draw a Circle in CSS css animations Magical Text Effect Bootstrap 4.2 Kitchen Sink CSS Frameworks Make your site look like windows 7 CSS Backgrounds Fancy up your banner image hero sections using overlay gradients CSS Modal Floating Modal Message Fixed on the Bottom of the Screen CSS Modal Create a modal with only CSS css grid display items in a css grid CSS Text Effects Using the selection selector to change the default highlight color Text Truncate your Text with CSS CSS Cursors Change your cursor into an Emoji Cursor or Image Cursor CSS How to Center Everything or Anything with CSS CSS Animations Smooth Scrolling with just CSS CSS Animations Radial Glow under cursor on box hover over effect CSS Shadows Using a filter drop shadow for transparent images CSS Animations Pure CSS 3D Flipping Book with Animations CSS Create a checkerboard background pattern with CSS CSS Animations button animations hover and fill animation CSS Animations button on focus swing animation CSS Animations Animated Button Border when Active Quick CSS create a border with top triangle in css CSS Animations Single Element CSS Spinners CSS Animations CSS Shake - Shake up your elements CSS Framework NES-style(8bit-like) CSS Framework CSS Tips Why to use a CSS Reset? Web Developer Checklists Front-End Checklist Icons Font Awesome Icons CSS Animation Animate Stuff with Animate.css CSS Animations Check Wave Click a Checkbox and Watch the Animation Animation Cloudy spiral animation with CSS3 Notifications Toast Messages and Notifications Standalone Library no JQuery - notify.js