Skip to content

Instantly share code, notes, and snippets.

@m2paulc
Created February 9, 2019 01:46
Show Gist options
  • Save m2paulc/ee9a02bdffe3e410b0ca469b9eadf1d3 to your computer and use it in GitHub Desktop.
Save m2paulc/ee9a02bdffe3e410b0ca469b9eadf1d3 to your computer and use it in GitHub Desktop.
CSS Challenge Day 033

CSS Challenge Day 033

Here is my version of day 33 of the CSS Challenge. I enjoyed making this one although I may have put too much animation. Seems like my pen is slowly going to a halt and crash.

A Pen by Paul on CodePen.

License.

<div class="frame">
<div class="center">
<div class="sun"></div>
<svg width="151px" height="72px" viewBox="0 0 151 72" class="cloud cloud-big" fill="#fff">
<path d="M12,71.8582223 C5.21541172,70.887763 0,65.0529438 0,58 C0,50.2680135 6.2680135,44 14,44 C15.3034487,44 16.565293,44.1781294 17.7625178,44.511373 C20.1480326,36.1342487 27.857651,30 37,30 C39.1595118,30 41.2390844,30.3422606 43.187432,30.9754962 C46.9847055,22.7265377 55.3236005,17 65,17 C65.5109562,17 66.0181831,17.0159673 66.5212088,17.0474302 C72.3931883,6.85865633 83.3956316,0 96,0 C110.201562,0 122.369492,8.70701098 127.456714,21.0739554 C140.625729,22.0732453 151,33.0751022 151,46.5 C151,60.4162144 139.852491,71.7287886 126,71.9951959 L126,72 L12,72 L12,71.8582223 Z"></path>
</svg>
<svg width="114px" height="57px" viewBox="0 0 114 57" class="cloud cloud-medium" fill="#fff">
<path d="M102.292651,56.3294118 C102.699178,56.3786089 103.112967,56.4039216 103.532606,56.4039216 C109.232649,56.4039216 113.853448,51.733637 113.853448,45.972549 C113.853448,41.7273454 111.344422,38.074432 107.743391,36.4460037 C107.045737,28.2547189 100.884497,21.6416815 92.9606326,20.347489 C90.4669137,12.8093882 83.4252407,7.37647059 75.1280873,7.37647059 C73.2303779,7.37647059 71.3983451,7.66067728 69.6713825,8.18927533 C65.0904074,3.15484259 58.5186473,0 51.2178418,0 C40.5642132,0 31.4630003,6.71786477 27.8347818,16.1910283 C27.2799765,16.1270113 26.7158185,16.0941176 26.1440592,16.0941176 C18.0011402,16.0941176 11.4,22.7659527 11.4,30.9960784 C11.4,31.8603273 11.472792,32.7073925 11.6125174,33.5313529 C11.5418336,33.5300607 11.4709926,33.5294118 11.4,33.5294118 C5.10395385,33.5294118 0,38.6333656 0,44.9294118 C0,51.2254579 5.10395385,56.3294118 11.4,56.3294118 L102.292651,56.3294118 Z"></path>
</svg>
<svg width="66px" height="30px" viewBox="0 0 66 30" class="cloud cloud-small" fill="#fff">
<path d="M59.2220612,29.6117647 C59.4574188,29.6402472 59.6969811,29.654902 59.9399299,29.654902 C63.239955,29.654902 65.9151539,26.951053 65.9151539,23.6156863 C65.9151539,20.4278856 63.4714352,17.8169586 60.3740905,17.5921689 C60.3771247,17.4853499 60.3786521,17.3781493 60.3786521,17.2705882 C60.3786521,11.195456 55.5059684,6.27058824 49.4952084,6.27058824 C47.9458135,6.27058824 46.4720386,6.59782346 45.1378489,7.18764375 C42.6089145,2.8842354 37.9639303,0 32.6524347,0 C26.0293785,0 20.4426347,4.48449926 18.7025163,10.6130879 C17.7233976,10.2175531 16.6548529,10 15.5360343,10 C11.567392,10 8.2313169,12.7373473 7.27525216,16.4458845 C7.05323696,16.4233226 6.82796823,16.4117647 6.6,16.4117647 C2.95492065,16.4117647 0,19.3666854 0,23.0117647 C0,26.6568441 2.95492065,29.6117647 6.6,29.6117647 L59.2220612,29.6117647 Z"></path>
</svg>
<svg width="24" height="24" viewBox="0 0 24 24" class="suv">
<path d="M3,6H16L19,10H21C22.11,10 23,10.89 23,12V15H21A3,3 0 0,1 18,18A3,3 0 0,1 15,15H9A3,3 0 0,1 6,18A3,3 0 0,1 3,15H1V8C1,6.89 1.89,6 3,6M2.5,7.5V10H10.5V7.5H2.5M12,7.5V10H17.14L15.25,7.5H12M6,13.5A1.5,1.5 0 0,0 4.5,15A1.5,1.5 0 0,0 6,16.5A1.5,1.5 0 0,0 7.5,15A1.5,1.5 0 0,0 6,13.5M18,13.5A1.5,1.5 0 0,0 16.5,15A1.5,1.5 0 0,0 18,16.5A1.5,1.5 0 0,0 19.5,15A1.5,1.5 0 0,0 18,13.5Z"></path>
</svg>
<svg width="24" height="24" viewBox="0 0 24 24" class="bike">
<path d="M5,20.5A3.5,3.5 0 0,1 1.5,17A3.5,3.5 0 0,1 5,13.5A3.5,3.5 0 0,1 8.5,17A3.5,3.5 0 0,1 5,20.5M5,12A5,5 0 0,0 0,17A5,5 0 0,0 5,22A5,5 0 0,0 10,17A5,5 0 0,0 5,12M14.8,10H19V8.2H15.8L13.86,4.93C13.57,4.43 13,4.1 12.4,4.1C11.93,4.1 11.5,4.29 11.2,4.6L7.5,8.29C7.19,8.6 7,9 7,9.5C7,10.13 7.33,10.66 7.85,10.97L11.2,13V18H13V11.5L10.75,9.85L13.07,7.5M19,20.5A3.5,3.5 0 0,1 15.5,17A3.5,3.5 0 0,1 19,13.5A3.5,3.5 0 0,1 22.5,17A3.5,3.5 0 0,1 19,20.5M19,12A5,5 0 0,0 14,17A5,5 0 0,0 19,22A5,5 0 0,0 24,17A5,5 0 0,0 19,12M16,4.8C17,4.8 17.8,4 17.8,3C17.8,2 17,1.2 16,1.2C15,1.2 14.2,2 14.2,3C14.2,4 15,4.8 16,4.8Z"></path>
</svg>
<svg width="24" height="24" viewBox="0 0 24 24" class="store"><path fill="none" d="M 0 0 h 24 v 24 H 0 Z" /><path d="M 20 4 H 4 v 2 h 16 V 4 Z m 1 10 v -2 l -1 -5 H 4 l -1 5 v 2 h 1 v 6 h 10 v -6 h 4 v 6 h 2 v -6 h 1 Z m -9 4 H 6 v -4 h 6 v 4 Z" /></svg>
<div class="road"></div>
<div class="ground"></div>
</div>
</div>
// jQuery v3.3.1 is supported
<script src="https://100dayscss.com/codepen/js/jquery.min.js"></script>
// delete the following line if no text is used
// edit the line if you wanna use other fonts
@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300);
// use only the available space inside the 400x400 frame
.frame {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 400px;
margin-top: -200px;
margin-left: -200px;
border-radius: 2px;
box-shadow: 4px 8px 16px 0 rgba(0,0,0,0.1);
overflow: hidden;
background: #2980B9; /* fallback for old browsers */
background: -webkit-linear-gradient(to top, #FFFFFF, #6DD5FA, #2980B9); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to top, #FFFFFF, #6DD5FA, #2980B9); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
color: #333;
font-family: 'Open Sans', Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.sun {
position: absolute;
height: 68px;
width: 68px;
top: -120px;
left: -100px;
background: radial-gradient(rgba(255, 217, 60, 1), rgba(250, 250, 250, 0.7));
box-shadow: 0 0 60px 20px #CFD8DC;
border-radius: 50%;
}
.cloud {
position: absolute;
top: -120px;
z-index: 4;
overview: hidden;
transform: translateX(-50%);
&-big {
top: -70px;
left: -280px;
-webkit-animation: moveBigCloud 42s linear infinite;
animation: moveBigCloud 42s linear infinite;
}
&-medium {
top: -180px;
left: -320px;
-webkit-animation: moveMedCloud 36s linear infinite;
animation: moveMedCloud 36s linear infinite;
}
&-small {
top: -100px;
left: -280px;
-webkit-animation: moveSmallCloud 20s linear infinite;
animation: moveSmallCloud 20s linear infinite;
}
}
.suv {
position: absolute;
width: 36px;
height: 36px;
bottom: -123px;
fill: orangered;
left: -180px;
z-index: 4;
transform: translate(-50%,-50%);
-webkit-animation: moveVehicles 14s linear infinite;
animation: moveVehicles 14s linear infinite;
}
.bike {
position: absolute;
bottom: -120px;
left: -220px;
z-index: 5;
fill: #37474F;
transform: translate(-50%,-50%);
-webkit-animation: moveVehicles 18s linear infinite;
animation: moveVehicles 18s linear infinite;
}
.store {
position: absolute;
width: 72px;
height: 72px;
bottom: -126px;
left: -280px;
z-index: 2;
transform: translate(-50%,-50%);
-webkit-animation: moveSmallCloud 32s linear infinite;
animation: moveSmallCloud 32s linear infinite;
}
.road {
position: absolute;
width: 100vw;
height: 1rem;
bottom: -130px;
background: #455A64;
transform: translateX(-50%);
}
.ground {
position: absolute;
width: 100vw;
height: 4rem;
bottom: -190px;
background: #2E7D32;
transform: translateX(-50%);
}
@keyframes moveBigCloud {
0% {
-webkit-transform: translate3d(320%, 0, 0);
transform: translate3d(320%, 0, 0);
}
100% {
-webkit-transform: translate3d(-60%, 0, 0);
transform: translate3d(-60%, 0, 0);
}
}
@keyframes moveMedCloud {
0% {
-webkit-transform: translate3d(460%, 0, 0);
transform: translate3d(460%, 0, 0);
}
100% {
-webkit-transform: translate3d(-10%, 0, 0);
transform: translate3d(-10%, 0, 0);
}
}
@keyframes moveSmallCloud {
0% {
-webkit-transform: translate3d(700%, 0, 0);
transform: translate3d(700%, 0, 0);
}
100% {
-webkit-transform: translate3d(-20%, 0, 0);
transform: translate3d(-20%, 0, 0);
}
}
@keyframes moveVehicles {
0% {
-webkit-transform: translate3d(-120%, 0, 0);
transform: translate3d(-120%, 0, 0);
}
100% {
-webkit-transform: translate3d(1800%, 0, 0);
transform: translate3d(1800%, 0, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment