Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<script src= "https://cdnjs.cloudflare.com/ajax/libs/gsap/3.7.1/gsap.min.js">   </script>

	<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg 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 1920 1080" style="enable-background:new 0 0 1920 1080;" xml:space="preserve">

<g id="Tank" class="st0">
	<g>
		<polyline class="st1" points="707.4,407.5 707.4,437.9 783.5,437.9 783.5,407.5 		"/>
	</g>
	<line class="st1" x1="745.5" y1="377.1" x2="745.5" y2="437.9"/>
</g>
<g id="Suction_Filter_with_bypass">
	<g id="Filter">
		<polygon class="st1" points="729.6,1006.5 691.5,983.7 729.6,960.8 767.6,983.7 		"/>
		<g>
			<g>
				<line class="st1" x1="729.6" y1="960.8" x2="729.6" y2="968.3"/>
				<line class="st2" x1="729.6" y1="978.6" x2="729.6" y2="993.9"/>
				<line class="st1" x1="729.6" y1="999" x2="729.6" y2="1006.5"/>
			</g>
		</g>
	</g>
	<g id="Check_Valve">
		<circle class="st1" cx="731.8" cy="944.3" r="7.6"/>
		<g>
			<line class="st1" x1="749.2" y1="944.3" x2="737.1" y2="954.4"/>
			<line class="st1" x1="749.2" y1="944.3" x2="737.1" y2="934.3"/>
		</g>
		<polyline class="st1" points="722.8,948.6 718.5,940.1 714.5,948.6 710.4,940.1 706,948.6 		"/>
	</g>
	<line class="st1" x1="653.2" y1="983.7" x2="690.4" y2="983.7"/>
	<path class="st1" d="M769.7,983.7c0.2-0.5,36.2,0,36.2,0"/>
	<polyline class="st3" points="668.4,983.7 668.4,944.4 704.5,944.4 	"/>
	<polyline class="st3" points="749.7,944.3 790.2,944.3 790.2,982.5 	"/>
	<circle id="Dot" class="st4" cx="668.4" cy="983.5" r="1.7"/>
	<circle id="Dot_00000018222943719003942890000004413606129045801355_" class="st4" cx="790.2" cy="983.7" r="1.7"/>
</g>
<g id="Tank_Big">
	<polyline class="st1" points="561,919.8 561,1026.5 835.2,1026.5 835.2,924.2 	"/>
</g>
<g id="Pump_Motor_Group">
	<g id="Pump">
		<circle class="st1" cx="639.2" cy="800.5" r="76.1"/>
		<polygon class="st5" points="637,730.2 617.2,764.4 656.8,764.4 		"/>
	</g>
	<g id="Motor">
		<circle class="st1" cx="450.2" cy="800.5" r="76.1"/>
		<text transform="matrix(1 0 0 1 413.542 827.2842)" class="st6 st7">M</text>
	</g>
	<line class="st1" x1="526.3" y1="800.5" x2="563.1" y2="800.5"/>
</g>
<g id="Lines_Skeleton">
	<polyline class="st1" points="637,722.7 637,647.3 637.1,342.6 	"/>
	<line class="st1" x1="744.1" y1="647.3" x2="637" y2="647.3"/>
	<polyline class="st1" points="682.8,345 682.8,374.5 745.5,374.5 	"/>
	<polyline class="st1" points="637,878.6 637,983.7 652.2,983.7 	"/>
	<polyline class="st1" points="500.2,118.3 500.2,145.3 637,145.3 637,262.1 	"/>
	<polyline class="st1" points="774.1,118.3 774.1,147.5 683.2,147.5 682.8,262.1 	"/>
	<circle class="st5" cx="637" cy="647.3" r="5.7"/>
</g>
<g id="Valve_Body">
	<g>
		<polyline class="st8" points="471.2,341.1 455.7,310.6 440.4,341.1 425.2,310.6 		"/>
		<g>
			<polygon class="st8" points="470.9,265 425.2,265 425.2,295.4 470.9,295.4 			"/>
			<line class="st8" x1="470.9" y1="295.4" x2="425.2" y2="265"/>
		</g>
	</g>
	<g>
		<polyline class="st8" points="849.1,340.1 864.4,309.6 879.6,340.1 894.8,309.6 		"/>
		<g>
			<polyline class="st8" points="849.1,265 894.8,265 894.8,295.4 849.1,295.4 			"/>
			<path class="st8" d="M849.1,295.4c15.2-10.1,30.4-20.3,45.7-30.4"/>
		</g>
	</g>
	<rect x="470.8" y="264.9" class="st8" width="378.2" height="76.1"/>
</g>
<g id="VCenter">
	<path class="st3" d="M707.7,306.9"/>
	<rect x="698.1" y="264.9" class="st9" width="76.1" height="76.1"/>
	<g>
		<line class="st10" x1="713.4" y1="266.8" x2="713.4" y2="338.8"/>
		<g>
			<line class="st8" x1="713.4" y1="278.3" x2="713.4" y2="338.8"/>
			<g>
				<polygon points="705.4,280.6 713.4,266.8 721.3,280.6 				"/>
			</g>
		</g>
	</g>
	<g>
		<g>
			<line class="st8" x1="758.9" y1="266.2" x2="758.9" y2="327.9"/>
			<g>
				<polygon points="750.9,325.6 758.9,339.4 766.8,325.6 				"/>
			</g>
		</g>
	</g>
	<polygon class="st9" points="622.3,341 546.2,341 545.9,265 622.3,264.9 	"/>
	<g>
		<g>
			<line class="st8" x1="561.1" y1="341.1" x2="600.7" y2="276.8"/>
			<g>
				<polygon points="606.3,283 606.8,267 592.7,274.6 				"/>
			</g>
		</g>
	</g>
	<g>
		<g>
			<line class="st8" x1="561.3" y1="267" x2="600.7" y2="330.8"/>
			<g>
				<polygon points="592.7,333 606.8,340.5 606.3,324.6 				"/>
			</g>
		</g>
	</g>
	<g id="Center_Closed">
		<rect x="622" y="264.9" class="st9" width="76.1" height="76.1"/>
		<g>
			<line class="st8" x1="637.1" y1="265.6" x2="637.1" y2="292.2"/>
			<line class="st8" x1="629.5" y1="292.1" x2="644.7" y2="292.2"/>
		</g>
		<g>
			<line class="st8" x1="682.9" y1="265.6" x2="682.9" y2="292.2"/>
			<line class="st8" x1="675.3" y1="292.1" x2="690.5" y2="292.2"/>
		</g>
		<g>
			<line class="st8" x1="682.9" y1="313.8" x2="682.7" y2="340.4"/>
			<line class="st8" x1="690.5" y1="313.9" x2="675.3" y2="313.7"/>
		</g>
		<g>
			<line class="st8" x1="637.3" y1="340.4" x2="637.5" y2="313.7"/>
			<line class="st8" x1="645.1" y1="313.9" x2="629.9" y2="313.7"/>
		</g>
	</g>
</g>
<g id="Relief_Valve">
	<rect x="806.6" y="602.1" class="st1" width="76.1" height="76.1"/>
	<g id="Arrow">
		<g>
			<line class="st1" x1="806.6" y1="663" x2="870.1" y2="663"/>
			<g>
				<polygon points="867.7,671 881.5,663 867.7,655 				"/>
			</g>
		</g>
	</g>
	<polyline class="st1" points="882.7,647.3 928.2,647.3 928.2,708.2 897.6,708.2 897.6,693.2 	"/>
	<polyline class="st1" points="958.7,692.9 958.7,708.2 928.2,708.2 	"/>
	<g id="Dashed_Line">
		<g>
			<line class="st1" x1="775.3" y1="647.3" x2="775.3" y2="654.8"/>
			<line class="st11" x1="775.3" y1="670.1" x2="775.3" y2="693"/>
			<polyline class="st1" points="775.3,700.7 775.3,708.2 782.8,708.2 			"/>
			<line class="st12" x1="795.1" y1="708.2" x2="838" y2="708.2"/>
			<polyline class="st1" points="844.1,708.2 851.6,708.2 851.6,700.7 			"/>
			<line class="st1" x1="851.6" y1="685.7" x2="851.6" y2="678.2"/>
		</g>
	</g>
	<g>
		<line x1="822.2" y1="600.6" x2="847.2" y2="564.2"/>
		<g>
			<line class="st1" x1="822.2" y1="600.6" x2="840.7" y2="573.7"/>
			<g>
				<polygon points="845.9,580.1 847.2,564.2 832.8,571.1 				"/>
			</g>
		</g>
	</g>
	<polyline class="st1" points="836.1,573.8 840.9,589.3 826.3,583.6 831.1,599.1 816.1,593.8 	"/>
	<circle class="st13" cx="775.3" cy="647.3" r="3.8"/>
	<polyline class="st1" points="745.5,647.3 803.5,647.3 805.1,647.3 	"/>
</g>
<g id="Cylinder">
	<rect x="485.1" y="39" class="st1" width="303.8" height="76.4"/>
	<g id="Rod">
		<line class="st1" x1="531.5" y1="39.4" x2="531.5" y2="115"/>
		<line class="st1" x1="531.5" y1="77.2" x2="835" y2="77.2"/>
	</g>
</g>
<g id="B2" class="st0">
	<polyline class="st14" points="637,714.6 637,647.3 637.1,350.9 	"/>
	<polyline class="st14" points="797,647.3 775.3,647.3 637,647.3 	"/>
	<polyline class="st14" points="775.3,647.3 775.3,708.2 851.6,708.2 851.6,687.7 	"/>
	<polyline class="st15" points="892.2,647.3 928.2,647.3 928.2,698.3 	"/>
	<polyline class="st14" points="637.3,340.4 682.9,265.6 683.2,147.5 774.1,147.5 774.1,125 	"/>
</g>
<g id="B1" class="st0">
	<polyline class="st14" points="637,714.6 637,647.3 637.1,350.9 	"/>
	<polyline class="st14" points="797,647.3 775.3,647.3 637,647.3 	"/>
	<polyline class="st14" points="775.3,647.3 775.3,708.2 851.6,708.2 851.6,687.7 	"/>
	<polyline class="st15" points="500.2,125 500.2,145.3 637,145.3 637,263 682.7,338.8 682.8,374.5 743.3,374.5 745.5,374.5 
		745.5,428.6 	"/>
	<polyline class="st14" points="637.3,340.4 682.9,265.6 683.2,147.5 774.1,147.5 774.1,125 	"/>
</g>
<g id="A2" class="st0">
	<polyline class="st14" points="637,255.5 637.1,145 500.2,145 500.2,124.8 	"/>
	<line class="st14" x1="637" y1="270.7" x2="637.5" y2="335.6"/>
	<g id="_x2B__Pump_Start_00000160153103951055787410000008783436106106307764_">
		<polyline class="st14" points="637,714.6 637,647.3 637.1,350.9 		"/>
		<polyline class="st14" points="797,647.3 775.3,647.3 637,647.3 		"/>
		<polyline class="st14" points="775.3,647.3 775.3,708.2 851.6,708.2 851.6,687.7 		"/>
		<polyline class="st15" points="892.2,647.3 928.2,647.3 928.2,698.3 		"/>
	</g>
</g>
<g id="A1" class="st0">
	<polyline class="st14" points="637,714.6 637,647.3 637.1,350.9 	"/>
	<polyline class="st14" points="797,647.3 775.3,647.3 637,647.3 	"/>
	<polyline class="st14" points="775.3,647.3 775.3,708.2 851.6,708.2 851.6,687.7 	"/>
	<polyline class="st14" points="637,255.5 637.1,145 500.2,145 500.2,124.8 	"/>
	<polyline class="st15" points="682.8,350.2 682.8,374.5 745.5,374.5 745.5,428.5 	"/>
	<polyline class="st15" points="682.8,255.5 683.2,147.5 774.1,147.5 774.1,124.8 	"/>
	<line class="st14" x1="637" y1="270.7" x2="637.5" y2="335.6"/>
	<line class="st15" x1="682.7" y1="270.5" x2="683.3" y2="335.4"/>
</g>
<g id="P" class="st0">
	<polyline class="st14" points="637,714.6 637,647.3 637.1,350.9 	"/>
	<polyline class="st14" points="797,647.3 775.3,647.3 637,647.3 	"/>
	<polyline class="st14" points="775.3,647.3 775.3,708.2 851.6,708.2 851.6,687.7 	"/>
	<polyline class="st15" points="892.2,647.3 928.2,647.3 928.2,698.3 	"/>
</g>
<g id="Solb">
	<polygon id="shock" class="st16" points="456.6,207.8 460.8,223.3 398.4,214.9 444.7,205.2 440.4,189.1 503,201.1 	"/>
	<text transform="matrix(1 0 0 1 412.0684 257.6738)" class="st6 st17">Sol. B</text>
</g>
<g id="Sola">
	<text transform="matrix(1 0 0 1 830.6934 255.8369)" class="st6 st18">Sol. A</text>
	<polygon id="shock_00000176012856458431965320000005046700626864642745_" class="st16" points="870.3,206.2 873.9,219.6 
		819.9,212.4 860,203.9 856.3,190 910.5,200.4 	"/>
</g>
<g id="Stop">
	<rect x="1161.1" y="843.5" class="st19" width="170" height="65"/>
	<text transform="matrix(1 0 0 1 1197.8123 890.6669)" class="st20 st6 st21">Stop</text>
	<rect x="1160" y="843.5" class="st22" width="172.3" height="65"/>
</g>
<g id="Start">
	<rect x="1161.4" y="747.7" class="st23" width="170" height="65"/>
	<text transform="matrix(1 0 0 1 1196.7456 794.864)" class="st6 st21">Start</text>
	<rect x="1160.2" y="747.7" class="st22" width="172.3" height="65"/>
</g>
<g id="B">
	<rect x="1378.3" y="844.4" class="st23" width="170" height="65"/>
	<text transform="matrix(1 0 0 1 1407.4989 891.5328)" class="st6 st21">Sol B.</text>
	<rect x="1377.1" y="844.4" class="st22" width="172.3" height="65"/>
</g>
<g id="A">
	<rect x="1378.3" y="744.4" class="st23" width="170" height="65"/>
	<text transform="matrix(1 0 0 1 1405.3792 791.5932)" class="st6 st21">Sol A.</text>
	<rect x="1377.1" y="744.4" class="st22" width="172.3" height="65"/>
</g>
</svg>

              
            
!

CSS

              
                <style type="text/css">
	.st0{opacity:0.8;}
	.st1{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;}
	.st2{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:10.2172,10.2172;}
	.st3{fill:none;stroke:#000000;stroke-width:4;stroke-miterlimit:10;}
	.st4{stroke:#000000;stroke-width:4;stroke-miterlimit:10;}
	.st5{stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;}
	.st6{font-family:'MyriadPro-Regular';}
	.st7{font-size:91.3033px;}
	.st8{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-miterlimit:10;}
	.st9{fill:#CCCCCC;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-miterlimit:10;}
	.st10{fill:#CCCCCC;}
	.st11{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:15.3029,15.3029;}
	.st12{fill:none;stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:12.2633,12.2633;}
	.st13{stroke:#000000;stroke-width:4;stroke-linecap:square;stroke-miterlimit:10;stroke-dasharray:3;}
	.st14{opacity:0.5;fill:none;stroke:#ED1C24;stroke-width:15;stroke-linecap:square;stroke-miterlimit:10;}
	.st15{opacity:0.5;fill:none;stroke:#0000FF;stroke-width:15;stroke-linecap:square;stroke-miterlimit:10;}
	.st16{fill:#FFCE3C;}
	.st17{font-size:34.5528px;}
	.st18{font-size:29.9357px;}
	.st19{fill:#FF0000;stroke:#000000;stroke-miterlimit:10;}
	.st20{fill:#F2F2F2;}
	.st21{font-size:50px;}
	.st22{fill:none;stroke:#000000;stroke-width:15;stroke-miterlimit:10;}
	.st23{fill:#00FF00;stroke:#000000;stroke-miterlimit:10;}
</style>
              
            
!

JS

              
                console.clear();

let btna = document.querySelector("#A");
let btnb = document.querySelector("#B");
let btnstart = document.querySelector("#Start");
let btnstop = document.querySelector("#Stop");
let animation;
let isButtonADisabled = true;
let isButtonBDisabled = true;


gsap.set("#A1, #A2, #B1, #B2, #P, #Solb, #Sola", {opacity:0});
gsap.set("#A, #B, #Stop, #Start", {opacity:0.7});


function stagea1() {
  let extenda1 = gsap.timeline ({defaults: {ease: "none"}}),
      speed = 40;
  extenda1.to("#Rod", {x:200, duration:Math.abs(200 - gsap.getProperty("#Rod", "x")) / speed})
       .to ("#Start, #A", {opacity:1},"<")
       .to ("#Stop, #B", {opacity:0.7},"<")
       .to ("#Arrow", {y:0, duration: 0.1}, "<")
       .to ("#VCenter", {x:-75.64, duration: 0.1}, "<")
       .to ("#Sola", {opacity: 1}, "<")
      .to("#P, #B1, #B2, #A2, #Solb", {opacity:0}, "<")
      .to("#A1", {opacity:1}, "<")
      .to("#A1", {opacity:0}, "+=0.1")
      .to("#A2", {opacity:1}, "<")
      .to ("#Arrow", {y:-15, ease: "none"}, "<")
      .to("#A2", {opacity:0}, "+=1")
      .to ("#VCenter", {x:0, duration: 0.1}, "<")
      .to ("#Sola", {opacity: 0}, "<")
      .to ("#P", {opacity:1}, "<")
      .to ("#A", {opacity:0.7});
  return extenda1;
}

function stagea2() {
  let extenda2 = gsap.timeline({defaults: {ease: "none"}}),
      speed = 40;
  extenda2.to("#P, #B1, #B2, #A1, #solb", {opacity:0})
       .to ("#Start, #A", {opacity:1},"<")
       .to ("#Stop, #B", {opacity:0.7},"<")
       .to ("#VCenter", {x:-75.64, duration: 0.1}, "<")
       .to ("#Sola", {opacity: 1}, "<")
      .to("#A2", {opacity:1, duration:1}, "<")
      .to("#A2", {opacity:0}, "+=1")
       .to ("#Sola", {opacity: 0}, "<")
      .to ("#VCenter", {x:0, duration: 0.1}, "<")
      .to ("#Arrow", {y:-15, duration: 0.1}, "<")
      .to ("#P", {opacity:1}, "<")
      .to ("#A", {opacity:0.7}); 
  return extenda2;
}


function stageb1() {
  let retractb1 = gsap.timeline ({defaults: {ease: "none"}}),
      speed = 50;
  retractb1.to("#Rod", {x:0, duration:Math.abs(0 - gsap.getProperty("#Rod", "x")) / speed})
       .to ("#Start, #B", {opacity:1},"<")
       .to ("#Stop, #A", {opacity:0.7},"<")
       .to ("#Arrow", {y:0, duration: 0.1}, "<")
       .to ("#VCenter", {x:75.64, duration: 0.1}, "<")
       .to ("#Solb", {opacity: 1}, "<")
      .to("#P, #A1, #A2, #B2, #Sola", {opacity:0}, "<")
       .to("#B1", {opacity:1}, "<")
      .to("#B1", {opacity:0}, "+=0.1")
      .to("#B2", {opacity:1}, "<")
      .to ("#Arrow", {y:-15}, "<")
      .to("#B2", {opacity:0}, "+=1")
      .to ("#VCenter", {x:0, duration: 0.1}, "<")
      .to ("#Solb", {opacity: 0}, "<")
      .to ("#P", {opacity:1}, "<")
      .to ("#Solb", {opacity:0}, "<")
       .to ("#B", {opacity:0.7}, "<");  
  return retractb1;
}

function stageb2() {
  let retractb2 = gsap.timeline ({defaults: {ease: "none"}}),
      speed = 50;
  retractb2.to("#P, #A1, #A2, #B1, #Sola",{opacity:0})
      .to("#B2", {opacity:1, duration: 1, ease: "none"},"<")
     .to ("#B, #Start", {opacity:1}, "<")
     .to ("#A, #Stop", {opacity:0.7}, "<")
      .to ("#Solb", {opacity: 1, duration: 1, ease:"none"}, "<")
     .to ("#VCenter", {x:75.64, duration: 0.1}, "<")
      .to("#B2",{opacity:0, ease: "none"}, "+=0.1")
      .to ("#Solb", {opacity: 0}, "<")
      .to ("#VCenter", {x:0, duration: 0.1}, "<")
      .to ("#Arrow", {y:-15, duration: 0.1}, "<")
       .to ("#B", {opacity:0.7}, "<")
      .to ("#P", {opacity:1, ease: "none"}, "<");
  return retractb2;
}

function stagestart() {
  let start1 = gsap.timeline ({
    defaults: {ease: "none"},
  });
      start1.to ("#A1, #A2, #B1, #B2", {opacity:0})
  .to ("#P, #Start", {opacity: 1}, "<")
  .to ("#Stop", {opacity:0.7})
  .to ("#Arrow", {y:-15, duration: 0.1}, "<");
  
  return start1
}

function stagestop() {
  let stop1 = gsap.timeline ({
    defaults: {ease: "none"},
  });
      stop1.to ("#A1, #A2, #B1, #B2, #P, #Sola, #Solb", {opacity:0})
   .to ("#A, #B, #Start", {opacity: 0.7})
   .to ("#Stop", {opacity:1})
   .to ("#Arrow, #VCenter", {y:0, x:0, duration: 0.1}, "<");
  return stop1
}


btna.onclick = () => {
  if(isButtonADisabled) return;
  if (gsap.getProperty("#Rod","x") < 200) {
      if(animation)animation.kill();
      animation = stagea1();
}
 else if (gsap.getProperty("#Rod","x") == 200) {
   if(animation)animation.kill();
   animation = stagea2();
   }
}

btnb.onclick = () => {
  if(isButtonBDisabled) return;
  if (gsap.getProperty("#Rod","x") > 0) {
      if(animation)animation.kill();
      animation = stageb1();
}
 else if (gsap.getProperty("#Rod","x") == 0) {
   if(animation)animation.kill();
   animation = stageb2();
   }
}

btnstop.onclick = () => {
  if(animation)animation.kill();
  animation = stagestop();
  isButtonBDisabled = true;
  isButtonADisabled = true;
}

btnstart.onclick = () => {
  isButtonBDisabled = false;
  isButtonADisabled = false;
  if (!animation || animation.isActive() === false){
    animation = stagestart();
  }
}
              
            
!
999px

Console