cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <html lang="en">
	<head>
		<title>Animated CSS+SVG Resposive Boat - Icon</title>

		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta charset="UTF-8">

		<!-- Own Styles-->
		<link rel="stylesheet" href="styles/boat.css">
	</head>
	<body>
    	<div class="icon-container">
    		<div class="toggle-button">Animate on Hover only</div>
			<!--boat-starts-->
			<div class="ac-animated-svg-icon ac-svg-animated">
				<div class="ac-animated-svg-icon-contents">
					<div class="ac-animated-svg-boat">
						<svg class="svg-boat" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
								 viewBox="0 0 160 192" style="enable-background:new 0 0 160 192;" xml:space="preserve">
							<style type="text/css">
								.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
								.st1{fill:#FFFFFF;}
							</style>
							<g>
								<path class="st0" d="M78,137h4c3.9,0,7,3.1,7,7v1H71v-1C71,140.1,74.1,137,78,137z"/>
								<path class="st0" d="M79,0h2c1.1,0,2,0.9,2,2v135h-6V2C77,0.9,77.9,0,79,0z"/>
								<path class="st0" d="M1.8,148h156.3c1,0,1.8,0.8,1.8,1.8l-23.8,26.2c0,20.1-8.1,15.5-28.4,15.5h-63c-20.2,0-23.8,2.8-23.8-17.3
									L0,149.8C0,148.8,0.8,148,1.8,148z"/>
								<path class="st1" d="M27,135l47.9-0.5L75,39L27,135z"/>
								<path class="st1" d="M133,135l-47.9-0.5L85,39L133,135z"/>
							</g>
						</svg>

						<svg class="svg-flag" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
								 viewBox="0 0 46 24" style="enable-background:new 0 0 46 24;" xml:space="preserve">
							<style type="text/css">
								.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
							</style>
							<path class="st0" d="M0,0h41c2.8,0,5,2.2,5,5v14c0,2.8-2.2,5-5,5H0V0z"/>
						</svg>

						<svg class="svg-water svg-water-1" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
							 	viewBox="0 0 150 15" style="enable-background:new 0 0 150 15;" xml:space="preserve">
							<style type="text/css">
								.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
							</style>
							<path class="st0" d="M0.2,10C23.4,3,48.2,8,74,10c25.7,2.4,52.1-0.9,75.5-10c0.2,0,0.3,0,0.5,0.3c-24.3,14.3-49.5,16.2-74.5,13.9
								C50.4,11.2,26,9.4,0,11.7C0.1,11.5,0.1,10.9,0.2,10L0.2,10L0.2,10z"/>
						</svg>
						<svg class="svg-water svg-water-2" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
							 	viewBox="0 0 150 15" style="enable-background:new 0 0 150 15;" xml:space="preserve">
							<style type="text/css">
								.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
							</style>
							<path class="st0" d="M0.2,10C23.4,3,48.2,8,74,10c25.7,2.4,52.1-0.9,75.5-10c0.2,0,0.3,0,0.5,0.3c-24.3,14.3-49.5,16.2-74.5,13.9
								C50.4,11.2,26,9.4,0,11.7C0.1,11.5,0.1,10.9,0.2,10L0.2,10L0.2,10z"/>
						</svg>
						<svg class="svg-water svg-water-3" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
							 	viewBox="0 0 150 15" style="enable-background:new 0 0 150 15;" xml:space="preserve">
							<style type="text/css">
								.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
							</style>
							<path class="st0" d="M0.2,10C23.4,3,48.2,8,74,10c25.7,2.4,52.1-0.9,75.5-10c0.2,0,0.3,0,0.5,0.3c-24.3,14.3-49.5,16.2-74.5,13.9
								C50.4,11.2,26,9.4,0,11.7C0.1,11.5,0.1,10.9,0.2,10L0.2,10L0.2,10z"/>
						</svg>
					</div>
				</div>
			</div>
			<!--boat-ends-->
		</div>
	</body>
</html>
            
          
!
            
              /*optional for bringing icon in center*/
.icon-container {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0px;
    top: 0px;
    bottom: 0px;
    right: 0px;
    background-color: #4F79BD;
    min-height: 400px;
}
.ac-animated-svg-icon {
  left: 50%;
  top: 56.5%;
  transform: translateX(-50%) translateY(-50%);
  border: 1px dashed #3F6197;
}
/*optional animation on hover toggle button */
.toggle-button {
  position: absolute;
  padding: 10px;
  padding-left: 20px;
  padding-right: 20px;
  font-family: sans-serif;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
  cursor: pointer;
  transition: background-color 0.5s;
  z-index: 1;
}
.toggle-button:hover {
  background-color: rgba(255, 255, 255, 1);
}
.toggle-button.toggle-on {
  background-color: rgba(28, 186, 110, 0.5);
}
.toggle-button.toggle-on:hover {
  background-color: rgba(28, 186, 110, 1);
}
/*optional ends*/

.ac-animated-svg-icon {
    /*icon - size*/
    width: 300px;
    height: 300px;

    display: inline-block;
    position: relative;
    box-sizing: border-box;
    text-align: center;
    background-color: #4f79bd;
    cursor: pointer;
}
.ac-animated-svg-icon .ac-animated-svg-icon-contents {
    position: absolute;
    /* icon - padding */
    left: 20px;
    top: 20px;
    right: 20px;
    bottom: 20px;
}
.ac-animated-svg-boat {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 100%;

    perspective-origin-y: 20%;
    perspective: 400px;
}
.ac-animated-svg-boat .svg-boat {
    height: 100%;
    padding-bottom: 10%;
    width: 100%;
    position: relative;
    z-index: 3;
    box-sizing: border-box;
}

.ac-animated-svg-icon:hover .ac-animated-svg-boat .svg-boat, .ac-animated-svg-icon.ac-svg-animated .ac-animated-svg-boat .svg-boat {
    animation: acAnimatedSvgIconBoatAnimation 1.1s linear infinite;
}

@keyframes acAnimatedSvgIconBoatAnimation {
    0% {
        transform: rotateZ(0deg) translateX(0%);
    }
    25% {
        transform: rotateZ(2deg) translateX(-3%);
    }
    50% {
        transform: rotateZ(0deg) translateX(0%);
    }
    75% {
        transform: rotateZ(1deg) translateX(2%);
    }
    100% {
        transform: rotateZ(0deg) translateX(0%);
    }
}

.ac-animated-svg-boat .svg-flag {
    position: absolute;
    width: 22%;
    left: 53%;
    top: 5%;
}

.ac-animated-svg-boat .svg-flag {
    transform-origin: 0% 100%;
}

.ac-animated-svg-icon:hover .ac-animated-svg-boat .svg-flag, .ac-animated-svg-icon.ac-svg-animated .ac-animated-svg-boat .svg-flag {
    animation: acAnimatedSvgIconBoatFlagAnimation 1.1s ease-in-out infinite;
}

@keyframes acAnimatedSvgIconBoatFlagAnimation {
    0% {
        transform: rotateY(0deg) translateX(0%);
    }
    25% {
        transform: rotateY(40deg) translateX(-2%);
    }
    50% {
        transform: rotateY(0deg) translateX(0%);
    }
    75% {
        transform: rotateY(-40deg) translateX(3%);
    }
    100% {
        transform: rotateY(0deg) translateX(0%);
    }
}

.ac-animated-svg-boat .svg-water {
    position: absolute;
    left: 0px;
    width: 100%;
    bottom: 0px;
    z-index: 1;
}
.ac-animated-svg-boat .svg-water-2 {
    bottom: 5%;
}
.ac-animated-svg-boat .svg-water-3 {
    bottom: 10%;
}

.ac-animated-svg-icon:hover .ac-animated-svg-boat .svg-water-1, .ac-animated-svg-icon.ac-svg-animated .ac-animated-svg-boat .svg-water-1 {
    animation: acAnimatedSvgIconBoatWaterAnimation1 1.1s ease-out infinite;
}

@keyframes acAnimatedSvgIconBoatWaterAnimation1 {
    0% {
        transform: translateY(0%);
    }
    50% {
        transform: translateY(-5%);
    }
    100% {
        transform: translateY(0%);
    }
}

.ac-animated-svg-icon:hover .ac-animated-svg-boat .svg-water-2, .ac-animated-svg-icon.ac-svg-animated .ac-animated-svg-boat .svg-water-2 {
    animation: acAnimatedSvgIconBoatWaterAnimation2 1.5s ease-out infinite;
}

@keyframes acAnimatedSvgIconBoatWaterAnimation2 {
    0% {
        transform: translateY(0%);
    }
    25% {
        transform: translateY(5%);
    }
    75% {
        transform: translateY(0%);
    }
    25% {
        transform: translateY(5%);
    }
}

.ac-animated-svg-icon:hover .ac-animated-svg-boat .svg-water-3, .ac-animated-svg-icon.ac-svg-animated .ac-animated-svg-boat .svg-water-3 {
    animation: acAnimatedSvgIconBoatWaterAnimation3 1s ease-out infinite;
}

@keyframes acAnimatedSvgIconBoatWaterAnimation3 {
    0% {
        transform: translateY(0%) rotateX(0deg);
    }
    25% {
        transform: translateY(-5%) rotateX(10deg);
    }
    100% {
        transform: translateY(0%) rotateX(0deg);
    }
}
            
          
!
            
              /*just for toggling animation on hover*/
var toggle = 0;
var button = document.querySelector(".toggle-button");
var icon = document.querySelector(".ac-animated-svg-icon");
button.addEventListener("click", function() {
  if (toggle == 0) { toggle = 1; } else { toggle = 0; }
  if (toggle == 1) {
    button.className = "toggle-button toggle-on";
    icon.className = "ac-animated-svg-icon";
  } else {
    button.className = "toggle-button";
    icon.className = "ac-animated-svg-icon ac-svg-animated";
  }
});
            
          
!
999px
Loading ..................

Console