HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!-- svg here -->
<svg id="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3000 3000">
<mask id="myMask">
<g class="mag">
<path fill="black" d="M811.4 507.53l-21.25 34.57-141.74-88.7 21.25-34.56 141.74 88.69z" />
<path d="M650.53 454.73l83.21 4.21-62-38.77s-9.91 20.53-21.21 34.56z" opacity=".18" />
<ellipse id="glass" cx="526.18" cy="346.81" fill="white" rx="157.21" ry="158.6" />
<path id="handle-end" fill="black" d="M938.7 604.26l-9.16 14.9a20.68 20.68 0 01-28.62 6.76L755.61 535a3.47 3.47 0 01-1.1-4.75L782 485.57a3.41 3.41 0 014.71-1.11L932 575.38a21.08 21.08 0 016.7 28.88z" />
<path id="round" fill="black" d="M669.42 436.44c-49 79.68-153.1 104.3-232.08 54.88S334 336.86 382.94 257.18 536 152.89 615 202.31s103.41 154.45 54.42 234.13zM396 265.35c-44.53 72.42-22.35 167.88 49.43 212.8s166.41 22.54 210.93-49.88 22.35-167.88-49.43-212.79S440.52 192.93 396 265.35z" />
<path id="light" fill="black" d="M543.35 210.76c-22.45-5.74-47.09-2.61-68.22 6.7-18.23 8-36 23.3-41.14 43.34-.78 3 2.87 6.5 5.5 3.78 12.31-12.77 25.34-24 41.77-31 18.79-8 38.67-7.14 58.54-6.08 9.37.5 13.28-14.25 3.55-16.74z" opacity=".61" />
</g>
</mask>
<rect x="-1000" y="-1000" width="4000" height="4000" fill="#6ba3d4"></rect>
<g id="object">
<g class="mag">
<g id="handle">
<path fill="#5d7a7f" d="M811.4 507.53l-21.25 34.57-141.74-88.7 21.25-34.56 141.74 88.69z" />
<path d="M650.53 454.73l83.21 4.21-62-38.77s-9.91 20.53-21.21 34.56z" opacity=".18" />
</g>
<ellipse id="glass" cx="526.18" cy="346.81" fill="#f2f2f2" opacity=".37" rx="157.21" ry="158.6" />
<path id="handle-end" fill="#153e49" d="M938.7 604.26l-9.16 14.9a20.68 20.68 0 01-28.62 6.76L755.61 535a3.47 3.47 0 01-1.1-4.75L782 485.57a3.41 3.41 0 014.71-1.11L932 575.38a21.08 21.08 0 016.7 28.88z" />
<path id="round" fill="#153e49" d="M669.42 436.44c-49 79.68-153.1 104.3-232.08 54.88S334 336.86 382.94 257.18 536 152.89 615 202.31s103.41 154.45 54.42 234.13zM396 265.35c-44.53 72.42-22.35 167.88 49.43 212.8s166.41 22.54 210.93-49.88 22.35-167.88-49.43-212.79S440.52 192.93 396 265.35z" />
<path id="light" fill="#fff" d="M543.35 210.76c-22.45-5.74-47.09-2.61-68.22 6.7-18.23 8-36 23.3-41.14 43.34-.78 3 2.87 6.5 5.5 3.78 12.31-12.77 25.34-24 41.77-31 18.79-8 38.67-7.14 58.54-6.08 9.37.5 13.28-14.25 3.55-16.74z" opacity=".61" />
<path id="ring" fill="#917fc7" d="M525.32 503.4c-85.71 0-155.44-70.34-155.44-156.82s69.73-156.82 155.44-156.82 155.45 70.35 155.45 156.82S611 503.4 525.32 503.4zm0-310.66c-84.08 0-152.49 69-152.49 153.84s68.41 153.84 152.49 153.84 152.5-69 152.5-153.84-68.41-153.84-152.5-153.84z" />
</g>
<g class="print" mask="url(#myMask)">
<rect x="-10000" y="-10000" width="20000" height="20000" fill="#73dfff"></rect>
<g id="prints" fill="none" stroke="grey" opacity="0.35" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
<g id="fingerprint">
<path d="M365.29 407.29c41.59-55 142.55-29.14 155.41 37.45M374.36 387.42c21.73-19.94 51.94-23.71 80.76-17M520 421.46c-10.64-27.5-36.05-44.27-64.88-51M381.57 373.5c21.24-16.3 49.13-19.08 75.84-12.83M519.71 405.79c-11.81-24-35.59-38.88-62.3-45.12M389.15 360.42c20.44-12.92 45.94-14.78 70.44-9.05M518.71 390.71c-12.6-20.64-34.63-33.62-59.12-39.34M401.4 346.24c18.4-7.95 39.67-8.49 60.25-3.68M514 372.57c-13-15.28-31.79-25.2-52.36-30M356.37 464.37c10.64 27.5 36.05 44.27 64.88 51M500 498.86c-21.73 19.93-49.9 23.26-78.72 16.51M356.66 480c11.82 24 35.59 38.88 62.3 45.12M494.8 512.33c-21.24 16.3-49.13 19.08-75.84 12.83M357.67 495.12c12.59 20.64 34.62 33.62 59.12 39.34M487.22 525.41c-20.44 12.92-45.94 14.78-70.43 9.05M362.36 513.26c13 15.28 31.79 25.2 52.37 30M475 539.59c-18.4 7.95-39.67 8.49-60.24 3.68M415.06 333.93c15.43-3.95 32.2-3.51 48.53.31M507.23 355.48c-12.07-10.39-27.31-17.42-43.64-21.24" />
<path d="M359.6 421.76c7.3-2.41 11.67-9.63 19-16.16s27.14-27.12 72.2-16.59" />
<path d="M518 458.79c-5.46-5.4-6.19-13.81-9.86-22.9s-12.3-36.35-57.35-46.88M366.27 463.14c4.44 10 14.92 33.18 57.13 43.05M493.69 492.92c-8.41 7-28.09 23.14-70.29 13.27M378.66 464.32c5.47 12.95 19.24 26.12 46.9 32.59M486.53 486.45c-11.85 9.58-30.63 17.55-61 10.46M393.84 469.93c5.61 8.17 19.94 13.93 34 17.22M480.78 478.24c-16.32 13.58-35.32 13-53.25 8.83M355.69 434.23c7.21-.89 18.19-9.89 28-18.64 20.11-18 33.66-24.62 65-17.3" />
<path d="M516 471.71c-6.07-4-11.92-16.94-16.8-29.12-10.05-25-19.26-37-50.56-44.3M426 322.45c11-.86 22.56-1.57 40.58 2.64M502.51 340.34c-9.45-5.64-19.51-11.41-37.51-15.63" />
<path d="M354.12 445.2c36-6.51 41.84-50 93.11-38 18.59 4.35 30 23.39 25.57 42.54s-23.18 31.17-41.8 26.82c-33.8-7.9-40.71-26.92-76.06-23.34M512.52 482.22c-18.79-13.93-19.84-35.92-31.53-53.1" />
<path d="M379.37 445.51c9.39 2.19 16.79 6.18 24.42 10.3 8.25 4.44 16.77 9 29.29 12 13.85 3.24 27.84-5.73 31.18-20S459 419.26 445.17 416c-23.7-5.54-37.62 3.76-51.8 16.35a137 137 0 01-15.89 12.73c.64.14 1.27.28 1.89.43z" />
<path d="M435.13 459c-11.41-2.66-19.07-6.79-27.17-11.16-3.82-2.06-7.69-4.15-11.87-6l3-2.62c13.71-12.17 25.85-18.61 44.06-14.35a17.55 17.55 0 01-8 34.17z" />
<path d="M437.18 450.2c-10.3-2.41-17.14-6.1-25.06-10.37l-.18-.1a34.87 34.87 0 0129.12-6.14 8.53 8.53 0 01-3.88 16.61zM509.84 491.21c-19.31-6.92-24.67-34.6-27.56-40.77 0 0-.82 15.25-11.65 23" />
</g>
<g id="fingerprint-2" data-name="fingerprint">
<path d="M2347.67 2315.29c56.57 39.47 34.53 141.35-31.53 156.72M2367.87 2323.6c20.74 21 25.66 51 20 80.06M2339.38 2470.43c27.08-11.68 42.87-37.7 48.51-66.77M2382.05 2330.28c17.09 20.6 20.93 48.37 15.7 75.3M2355 2469.54c23.56-12.72 37.5-37 42.72-64M2395.4 2337.36c13.69 19.93 16.52 45.34 11.73 70M2370.06 2468c20.15-13.37 32.28-35.88 37.07-60.57M2410 2349.06c8.64 18.08 10 39.32 6 60.06M2388 2462.59c14.77-13.54 24-32.73 28-53.47M2290.29 2308.55c-27.07 11.68-42.87 37.7-48.5 66.77M2261.28 2453.35c-20.74-20.95-25.14-49-19.49-78M2274.64 2309.44c-23.56 12.71-37.5 37-42.72 64M2247.62 2448.7c-17.09-20.6-20.93-48.37-15.7-75.3M2259.61 2311c-20.15 13.37-32.28 35.88-37.06 60.57M2234.27 2441.62c-13.69-19.93-16.52-45.34-11.72-70M2241.66 2316.39c-14.78 13.54-24 32.73-28 53.47M2219.63 2429.92c-8.64-18.08-10-39.32-6-60.06M2422.86 2362.24c4.54 15.26 4.73 32 1.54 48.51M2404.83 2455.16c9.92-12.46 16.37-27.95 19.57-44.41" />
<path d="M2333 2310.16c2.69 7.2 10.07 11.3 16.87 18.36s28.13 26.09 19.32 71.51M2302 2469.85c5.18-5.67 13.56-6.71 22.51-10.72s35.85-13.67 44.66-59.1M2291.89 2318.39c-9.81 4.82-32.59 16.17-40.84 58.72M2267 2446.85c-7.3-8.14-24.18-27.18-15.92-69.74M2291.18 2330.82c-12.73 5.95-25.37 20.22-30.78 48.11M2273.17 2439.45c-10-11.48-18.7-29.94-12.77-60.52M2286.16 2346.2c-8 5.92-13.16 20.45-15.92 34.64M2281.16 2433.39c-14.19-15.79-14.36-34.8-10.85-52.87" />
<path d="M2320.38 2306.72c1.16 7.17 10.58 17.8 19.69 27.24 18.76 19.41 25.88 32.7 19.76 64.26M2289 2468.32c3.76-6.21 16.47-12.55 28.46-17.89 24.65-11 36.23-20.66 42.35-52.21M2434.75 2372.74c1.27 10.93 2.43 22.48-1.1 40.65M2419.78 2449.87c5.27-9.66 10.66-19.94 14.19-38.11" />
<path d="M2309.36 2305.58c7.88 35.76 51.51 39.9 41.48 91.59-3.64 18.75-22.23 30.91-41.54 27.16s-32-22-28.36-40.72c6.61-34.08 25.35-41.71 20.43-76.9M2278.38 2465.27c13.21-19.32 35.14-21.19 51.87-33.53" />
<path d="M2310 2330.81c-1.84 9.47-5.54 17-9.36 24.8-4.13 8.41-8.4 17.1-10.85 29.72-2.71 14 6.79 27.61 21.17 30.4s28.3-6.31 31-20.28c4.64-23.9-5.19-37.46-18.31-51.15a136 136 0 01-13.32-15.39c-.08.64-.2 1.28-.33 1.9z" />
<path d="M2298.66 2387.05c2.24-11.51 6.07-19.32 10.13-27.58 1.91-3.89 3.85-7.84 5.58-12.09.93 1 1.84 1.94 2.73 2.87 12.69 13.23 19.58 25.12 16 43.48a17.56 17.56 0 01-34.46-6.68z" />
<path d="M2307.52 2388.76c2-10.39 5.44-17.36 9.41-25.44l.09-.18a34.84 34.84 0 017.24 28.87 8.53 8.53 0 01-16.74-3.25zM2269.3 2462.93c6.18-19.56 33.64-26 39.69-29.1 0 0-15.27-.23-23.45-10.76" />
</g>
<g id="fingerprint-3" data-name="fingerprint">
<path d="M2080.33 1186.11c-37.11-58.16 22.33-143.78 89.24-132.64M2064.86 1170.68c-11.12-27.31-4.13-56.94 12.23-81.61M2147.5 1046c-29.48.39-54.06 18.37-70.41 43M2054.32 1159.07c-7.87-25.58-.76-52.7 14.4-75.56M2132.7 1040.83c-26.63 2.71-48.83 19.82-64 42.68M2044.71 1147.41c-5-23.66 2.14-48.21 16.05-69.17M2118.22 1036.52c-23.74 4.62-43.57 20.75-57.46 41.72M2035.68 1131c-1-20 5.86-40.14 17.54-57.75M2099.58 1034.6c-18.84 6.83-34.69 21-46.36 38.64M2130.73 1214.34c29.48-.39 54.05-18.37 70.41-43M2213.07 1091.75c11.12 27.31 4.43 54.87-11.93 79.55M2145.52 1219.53c26.64-2.71 48.84-19.82 64-42.68M2223.9 1101.29c7.88 25.58.77 52.7-14.39 75.56M2160 1223.84c23.73-4.61 43.57-20.74 57.46-41.72M2233.52 1113c5 23.66-2.14 48.21-16.05 69.17M2178.65 1225.76c18.84-6.83 34.69-21 46.36-38.64M2242.55 1129.37c1 20-5.86 40.15-17.54 57.75M2028.9 1113.9c1.66-15.84 7.92-31.41 17.19-45.38M2081.2 1035c-13.94 7.7-25.84 19.53-35.11 33.51" />
<path d="M2091.91 1196.48c.28-7.68-5-14.3-8.53-23.43s-16-34.89 9.59-73.46M2181.79 1060.89c-7 3.24-15.09 1-24.9 1.27s-38.35-1.13-63.92 37.43M2133 1204.64c10.91-.69 36.3-2.43 60.25-38.56M2205.32 1095.58c3.62 10.31 11.9 34.37-12.05 70.5M2138.45 1193.43c14-.61 31.19-8.93 46.88-32.61M2196.76 1100c4.86 14.45 5.79 34.82-11.43 60.79M2149 1181.16c9.62-2.41 20-13.84 28-25.88M2187.06 1102.56c7.05 20-.09 37.65-10.26 53" />
<path d="M2102.24 1204.49c1.68-7.07-2.94-20.5-7.74-32.71-9.87-25.12-11.35-40.13 6.41-66.92" />
<path d="M2193.2 1067.28c-5.86 4.3-20 5.28-33.15 5.61-27 .7-41.38 5.18-59.14 32M2022 1099.65c3-10.59 6.38-21.7 16.61-37.12M2065.36 1034.16c-8.57 6.9-17.49 14.32-27.72 29.75" />
<path d="M2112 1209.77c6.45-36-32.25-56.61-3.16-100.49 10.55-15.92 32.39-20 48.78-9.16s21.12 32.58 10.57 48.5c-19.18 28.93-39.41 28.79-48.37 63.17M2201.85 1074.19c-19.61 12.77-40.58 6.08-60.76 11.06" />
<path d="M2121.06 1186.22c5.33-8 11.64-13.59 18.16-19.31 7-6.18 14.31-12.57 21.41-23.28 7.87-11.86 4.33-28.1-7.88-36.2s-28.55-5-36.42 6.83c-13.45 20.29-9.57 36.59-2.71 54.26a136 136 0 016.39 19.33c.35-.56.7-1.1 1.05-1.63z" />
<path d="M2153.11 1138.64c-6.47 9.77-13 15.51-19.93 21.59-3.25 2.85-6.56 5.76-9.79 9-.48-1.27-1-2.5-1.42-3.7-6.64-17.09-8.45-30.71 1.89-46.3a17.55 17.55 0 0129.25 19.39z" />
<path d="M2145.59 1133.66c-5.85 8.82-11.69 13.95-18.45 19.88l-.15.14a34.82 34.82 0 014.39-29.44 8.53 8.53 0 0114.21 9.42zM2209.34 1079.84c-13.21 15.69-41 11.07-47.82 11.63 0 0 14 6.08 17.53 18.94" />
</g>
<g id="fingerprint-4" data-name="fingerprint">
<path d="M806.13 2098c56.57 39.47 34.54 141.35-31.53 156.72M826.33 2106.34c20.74 21 25.66 51 20 80.06M797.84 2253.17c27.08-11.68 42.87-37.7 48.51-66.77M840.52 2113c17.09 20.6 20.92 48.37 15.69 75.3M813.5 2252.28c23.55-12.72 37.49-37 42.71-64M853.87 2120.1c13.68 19.93 16.51 45.34 11.72 70M828.52 2250.71c20.15-13.37 32.28-35.88 37.07-60.57M868.5 2131.8c8.65 18.08 10 39.32 6 60.06M846.48 2245.33c14.77-13.54 24-32.73 28-53.47M748.75 2091.29c-27.07 11.68-42.87 37.7-48.5 66.77M719.74 2236.09c-20.74-21-25.14-49-19.49-78M733.1 2092.18c-23.56 12.71-37.5 37-42.72 64M706.08 2231.44c-17.09-20.6-20.93-48.37-15.7-75.3M718.07 2093.75c-20.15 13.37-32.28 35.88-37.06 60.57M692.73 2224.36c-13.69-19.93-16.52-45.34-11.72-70M700.12 2099.13c-14.78 13.54-24 32.73-28 53.47M678.09 2212.66c-8.64-18.08-10-39.32-6-60.06M881.32 2145c4.54 15.26 4.73 32 1.54 48.51M863.29 2237.9c9.92-12.46 16.38-28 19.57-44.41" />
<path d="M791.45 2092.9c2.69 7.19 10.07 11.3 16.87 18.36s28.14 26.09 19.32 71.51M760.47 2252.59c5.18-5.67 13.56-6.71 22.51-10.72s35.85-13.67 44.66-59.1M750.36 2101.13c-9.81 4.82-32.6 16.17-40.85 58.72M725.43 2229.59c-7.29-8.14-24.18-27.18-15.92-69.74M749.65 2113.56c-12.74 6-25.38 20.22-30.79 48.11M731.63 2222.19c-10-11.48-18.7-29.94-12.77-60.52M744.62 2128.94c-8 5.92-13.16 20.45-15.92 34.64M739.62 2216.13c-14.19-15.79-14.36-34.8-10.85-52.87" />
<path d="M778.84 2089.46c1.16 7.17 10.58 17.8 19.7 27.24 18.75 19.41 25.87 32.7 19.75 64.26M747.48 2251.06c3.76-6.21 16.47-12.55 28.46-17.89 24.65-11 36.23-20.66 42.35-52.21M893.21 2155.48c1.27 10.93 2.43 22.48-1.1 40.64M878.24 2232.61c5.27-9.66 10.67-19.94 14.19-38.11" />
<path d="M767.82 2088.32c7.88 35.75 51.51 39.9 41.48 91.59-3.64 18.75-22.23 30.91-41.53 27.16s-32-22-28.37-40.72c6.62-34.08 25.35-41.71 20.43-76.9M736.84 2248c13.21-19.32 35.15-21.19 51.87-33.53" />
<path d="M768.47 2113.55c-1.84 9.47-5.54 17-9.36 24.8-4.13 8.41-8.4 17.1-10.85 29.72-2.71 14 6.79 27.61 21.18 30.4s28.29-6.31 31-20.28c4.64-23.9-5.19-37.46-18.31-51.15a136 136 0 01-13.32-15.39c-.1.64-.22 1.28-.34 1.9z" />
<path d="M757.12 2169.79c2.24-11.51 6.07-19.32 10.13-27.58 1.91-3.89 3.85-7.84 5.58-12.09.93 1 1.84 1.94 2.74 2.87 12.68 13.23 19.57 25.12 16 43.48a17.31 17.31 0 01-20.47 13.39c-9.49-1.86-15.77-10.86-13.98-20.07z" />
<path d="M766 2171.5c2-10.39 5.45-17.36 9.41-25.44l.09-.18a34.84 34.84 0 017.24 28.87 8.53 8.53 0 01-16.74-3.25zM727.76 2245.66c6.18-19.55 33.64-26 39.7-29.09 0 0-15.28-.23-23.45-10.76" />
</g>
</g>
</g>
</g>
</svg>
<p> Hunt for fingerprints - click and hold to zoom </p>
@import url("https://fonts.googleapis.com/css2?family=Signika:wght@500&display=swap");
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
margin: 0;
cursor: grab;
background-color: #6ba3d4;
}
svg {
margin: 0 auto;
overflow: visible;
height: 100vh;
width: 100vw;
}
p {
position: fixed;
width: 100vw;
text-align: center;
bottom: 2rem;
color: white;
font-size: 1.4rem;
font-family: "Signika", sans-serif;
pointer-events: none;
}
const svg = document.getElementById("svg");
const mag = document.querySelectorAll(".mag");
const pt = svg.createSVGPoint();
const xSet = gsap.quickSetter(mag, "x");
const ySet = gsap.quickSetter(mag, "y");
const NS = svg.getAttribute("xmlns");
let xPosition;
let yPosition;
let storedXPosition;
let storedYPosition;
let isZoomed = false;
function moveMag() {
if (storedXPosition === xPosition && storedYPosition === yPosition) return;
pt.x = xPosition;
pt.y = yPosition;
const svgP = pt.matrixTransform(svg.getScreenCTM().inverse());
xSet(svgP.x - 900);
ySet(svgP.y - 600);
storedXPosition = xPosition;
storedYPosition = yPosition;
}
gsap.ticker.add(moveMag);
function updateMouseCoords(event) {
if (isZoomed === true) return;
xPosition = event.clientX;
yPosition = event.clientY;
}
window.addEventListener("mousemove", updateMouseCoords);
svg.addEventListener("mousedown", (e) => {
isZoomed = true;
const clickPt = svg.createSVGPoint();
clickPt.x = e.clientX;
clickPt.y = e.clientY;
const svgPt = clickPt.matrixTransform(svg.getScreenCTM().inverse());
let coords = `${svgPt.x - 630} ${svgPt.y - 500} 500 500`;
gsap.to("svg", {
duration: 1,
attr: { viewBox: coords },
ease: Power4.easeOut
});
});
svg.addEventListener("mouseup", (e) => {
isZoomed = false;
gsap.to("svg", {
duration: 1,
attr: { viewBox: "0 0 3000 3000" },
ease: Power4.easeOut
});
});
Also see: Tab Triggers