Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                <button id="toggle">toggle</button>

<svg 
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 280 250" class="svg">
   <path id="gear" d="M17.582,74.637C21.6,54.25,24.94,33.192,31.211,13.358c0.176-0.558,0.354-1.129,0.585-1.667 c0.61-1.414-2.076,0.012-2.323-0.881c0.393,1.419,0.001,3.57-0.098,5.083c-0.617,9.454-0.858,18.928-1.142,28.396 c-0.302,10.075-0.593,20.155-1.25,30.214c-0.414,6.336-0.304,14.1-3.012,19.996c-0.32,0.696-0.721,0.677-0.178,0.911 c-1.357-0.587-2.271-2.839-2.937-4.054c-2.391-4.368-3.553-9.472-4.579-14.304c-1.445-6.802-2.286-13.815-2.608-20.764 c-0.105-2.27-3.338-2.24-3.5,0c-0.311,4.295-0.762,8.581-1.29,12.854c-0.604,4.893-0.726,13.747-4.158,17.697 c-1.473,1.695,0.992,4.182,2.475,2.475c3.794-4.365,4.096-12.208,4.851-17.636c0.709-5.106,1.25-10.247,1.623-15.39 c-1.167,0-2.333,0-3.5,0c0.611,13.162,1.809,30.4,10.446,40.973c2.439,2.986,5.526,1.156,6.731-1.801 c2.354-5.772,2.517-12.691,2.986-18.82c1.495-19.572,1.261-39.235,2.418-58.826c0.116-1.959,1.595-8.602-1.312-9.538 c-2.614-0.842-3.507,3.794-3.982,5.377c-5.871,19.549-9.308,40.04-13.252,60.05C13.772,75.911,17.146,76.851,17.582,74.637 L17.582,74.637 M21.555,94.504c4.51-10.88,9.11-21.748,14.162-32.39c1.052-2.216,2.126-4.435,3.374-6.549 c1.708-2.896-1.559,2.477-1.768-1.923c0.054,1.132,0.003,2.279,0.008,3.413c0.036,7.529,0.194,15.07,0.77,22.58 c0.188,2.449,0.067,12.459,3.847,13.02c4.177,0.619,4.676-5.848,4.98-8.621c0.732-6.667,0.308-13.582-0.519-20.219 c-0.318-2.553-0.639-10.245-4.111-11.061c-8.427-1.979-8.753,37.621-6.505,43.811c1.774,4.886,5.811,3.152,7.924-0.4 c2.185-3.674,3.392-8.033,4.574-12.101c2.473-8.513,4.145-17.267,5.713-25.983c-1.146-0.154-2.292-0.31-3.438-0.465 c-1.349,10.391-3.129,21.594-1.882,32.052c0.363,3.047,2.313,6.835,5.627,3.904c2.311-2.044,3.647-5.707,4.804-8.456 c1.953-4.643,3.476-9.43,4.876-14.264c0.473-1.631,0.925-3.269,1.403-4.897c0.157-0.535,0.327-1.065,0.506-1.594 c0.404-1.19-2.774-1.782-2.684-0.327c0.365,5.854-0.524,11.927-1.122,17.739c-0.16,1.562-2.093,16.565,3.771,10.737 c4.108-4.084,5.659-11.723,7.528-16.968c1.213-3.402,2.424-6.808,3.783-10.155c0.527-1.297,1.119-2.567,1.796-3.792 c1.017-1.84-0.496-1.473-0.242-0.45c1.792,7.204,0.434,16.353-0.774,23.552c-0.212,1.267-0.497,2.519-0.811,3.764 c-0.131,0.495-0.279,0.985-0.444,1.471c-0.758,2.355-0.277-0.415,0.87,1.276c-2.26-3.335-1.666-10.118-1.847-13.935 c-0.187-3.94-0.132-7.971,0.585-11.859c0.199-1.076,0.495-2.159,1.015-3.126c-0.022,0.042-0.935-0.957-0.521,0.715 c0.658,2.659-0.089,5.762-0.721,8.339c-1.225,4.996-2.003,9.638-1.57,14.808c0.288,3.433,2.058,12.252,7.386,10.786 c5.838-1.605,6.784-13.591,7.778-18.347c1.701-8.14,2.947-16.376,4.135-24.604c0.627-4.34,0.855-8.943,1.935-13.203 c-1.125-0.31-2.25-0.621-3.375-0.931c-3.536,14.798-6.875,29.904-7.939,45.109c-0.295,4.223-1.386,13.555,3.933,15.409 c3.536,1.232,8.842-2.478,10.879-5.059c1.657-2.099,2.371-5.073,1.779-7.696c-0.497-2.202-3.871-1.269-3.375,0.93 c1.042,4.619-8.072,12.487-9.516,5.844c-1.389-6.392,0.081-13.89,0.992-20.244c1.609-11.221,3.987-22.341,6.621-33.362 c0.524-2.192-2.819-3.121-3.375-0.931c-1.575,6.213-1.875,12.957-2.834,19.286c-0.806,5.321-1.701,10.628-2.714,15.913 c-1.074,5.596-1.996,11.832-4.55,16.973c-1.909,3.841-3.487-1.999-3.883-3.596c-0.926-3.736-0.637-7.841-0.049-11.595 c0.671-4.292,2.263-8.182,2.115-12.596c-0.092-2.742-2.503-8.146-5.656-4.405c-1.542,1.829-1.949,4.633-2.227,6.912 c-0.773,6.335-0.385,12.769,0.319,19.093c0.274,2.466,0.397,6.222,2.389,8.037c1.591,1.448,3.358,0.053,4.16-1.448 c3.859-7.227,3.459-18.422,3.242-26.3c-0.049-1.773-0.693-12.573-5.243-8.277c-3.293,3.108-4.646,9.079-6.132,13.17 c-2.102,5.784-3.792,11.974-6.769,17.388c-0.151,0.267-0.313,0.526-0.487,0.778c-0.992,1.503,0.888,2.161,0.836,1.086 c-0.092-1.918,0.232-3.9,0.426-5.803c0.588-5.783,1.165-11.553,1.377-17.365c0.054-1.471,0.525-4.194-0.681-5.4 c-1.125-1.125-2.633-0.281-3.167,0.938c-2.687,6.131-3.774,13.039-6.185,19.314c-0.996,2.593-2.527,7.581-4.986,9.281 c1.001-0.692,1.023,0.801,0.61-1.057c-0.255-1.149-0.277-2.36-0.326-3.531c-0.402-9.629,0.874-19.493,2.111-29.031 c0.254-1.955-3.09-2.396-3.438-0.465c-2.021,11.228-4.094,22.721-8.159,33.427c-0.65,1.714-1.556,4.463-3.117,5.63 c-0.208,0.156,0.355,0.349,0.079-0.072c-0.503-0.765-0.672-1.761-0.863-2.638c-1.454-6.697-0.545-14.194,0.185-20.915 c0.496-4.565,1.151-9.164,2.301-13.616c0.239-0.929,0.494-2.175,1.105-2.95c-0.765,0.971-1.572-0.747-0.993,0.252 c0.283,0.488,0.424,1.063,0.587,1.598c1.846,6.083,1.958,12.937,1.982,19.24c0.012,2.998-0.094,6.036-0.592,8.996 c-0.157,0.935-0.364,1.919-0.774,2.779c-0.295,0.62,0.972,1.151,0.414-0.795c-1.981-6.909-1.641-14.886-1.823-22.006 c-0.083-3.217-0.118-6.435-0.134-9.652c-0.006-1.22,0.456-3.64-0.671-4.544c-4.1-3.287-10.849,15.808-11.818,17.984 c-3.497,7.853-6.867,15.765-10.158,23.706C17.316,95.659,20.704,96.559,21.555,94.504L21.555,94.504 M103.61,64.436c-1.752,6.062-3.63,12.103-5.791,18.032c-0.562,1.542-1.162,3.071-1.867,4.555 c-0.213,0.448-0.444,0.964-0.757,1.354c1.56,1.035,2.212,1.095,1.959,0.178c-0.029-0.379-0.042-0.758-0.04-1.138 c-0.045-2.738,0.461-11.035,3.659-5.394c0.902,1.593,1.049,3.015,2.539,4.113c9.724,7.17,30.308-46.826,32.15-52.559 c-1.146-0.155-2.292-0.31-3.438-0.465c0.961,14.183,1.698,28.397,1.989,42.61c0.131,6.42,0.915,13.848-0.742,20.137 c-0.068,0.261-0.067,0.256-0.188,0.462c1.738,0.089,2.183-0.148,1.331-0.713c-0.468-0.39-0.938-0.776-1.413-1.158 c-2.251-1.828-4.569-3.576-6.896-5.308c-4.241-3.157-8.735-6.801-13.722-8.711c-1.619-0.62-3.016,1.82-1.702,2.925 c5.161,4.34,12.715,1.633,17.768-1.328c6.416-3.761,10.8-10.939,14.719-17.018c9.847-15.276,19.489-32.926,24.081-50.638 c0.573-2.212-2.623-3.03-3.375-0.931c-8.571,23.933-11.052,54.049-2.618,78.281c0.694,1.993,2.039,4.555,4.563,3.868 c2.501-0.681,3.76-4.662,4.668-6.685c2.415-5.382,4.962-10.633,7.593-15.912c1.797-3.604,3.27-7.381,4.64-11.164 c0.55-1.52,1.049-3.058,1.547-4.596c0.234-0.725,1.494-3.174,0.438-2.411c-0.856-0.349-1.714-0.697-2.57-1.046 c0.323,0.797-0.223,3.287-0.31,4.309c-0.284,3.328-0.555,6.656-0.779,9.989c-0.335,4.98-1.096,10.562-0.178,15.523 c0.318,1.723,1.462,3.169,3.331,2.226c2.296-1.159,2.979-6.804,3.935-8.985c3.485-7.95,8.189-15.552,13.158-22.654 c0.697-0.997,1.415-1.98,2.228-2.887c0.901-1.006-1.93-2.52-2.379-1.223c-0.211,0.609-0.487,1.202-0.729,1.799 c-1.648,4.086-3.118,8.248-4.53,12.42c-0.875,2.582-5.911,13.177-1.714,14.888c1.844,0.752,3.523-2.355,4.305-3.42 c2.823-3.85,5.714-7.649,8.669-11.398c1.98-2.513,3.958-5.157,6.312-7.341c-0.725-0.497-1.449-0.994-2.174-1.491 c-0.17,0.473-0.369,0.932-0.597,1.379c-0.44,0.951-0.907,1.892-1.367,2.834c-1.203,2.461-2.425,4.913-3.586,7.395 c-0.841,1.797-5.862,14.24,1.173,10.823c7.909-3.841,13.71-12.041,20.673-17.298c0.432-0.326,0.935-0.737,1.445-0.938 c-0.97-1.688-1.557-2.015-1.76-0.983c-0.251,0.545-0.506,1.088-0.767,1.629c-1.278,2.695-2.113,5.597-2.841,8.48 c-0.937,3.715-2.665,9.986-0.832,13.695c3.366,6.808,13.619-12.451,15.045-14.574c1.114-1.659,2.205-3.409,3.565-4.883 c-1.495-1.875-2.343-2.172-2.543-0.893c-0.147,0.454-0.309,0.903-0.484,1.347c-0.748,1.989-1.606,3.942-2.402,5.913 c-1.81,4.48-3.583,8.98-5.24,13.521c-0.701,1.92,2.194,2.986,3.198,1.348c2.543-4.15,5.143-8.268,7.802-12.344 c1.616-2.479,3.23-4.996,5.067-7.319c0.229-0.291,0.475-0.566,0.728-0.838c0.841-0.901-2.02-2.29-2.398-0.993 c-0.638,2.188-1.734,4.285-2.556,6.403c-1.427,3.681-3.374,9.072-2.358,13.137c0.392,1.565,1.991,3.509,3.796,2.282 c2.907-1.978,3.797-6.892,5.228-9.824c1.954-4.01,4.192-7.908,6.547-11.696c-1.065-0.449-2.132-0.898-3.198-1.348 c-1.8,5.536-3.495,11.109-5.065,16.715c-0.804,2.874-4.708,11.997-1.415,14.4c3.065,2.239,5.381-6.914,5.819-8.196 c3.024-8.843,5.367-17.94,7.561-27.019c2.47-10.219,4.566-20.546,5.902-30.977c0.419-3.273,2.433-11.904-2.275-13.507 c-3.865-1.316-7.999,3.348-10.294,5.744c-5.73,5.981-10.432,13.048-14.869,20.006c-11.52,18.064-19.609,37.024-25.292,57.636 c-0.338,1.224-6.984,20.711-0.965,19.669c2.222-0.385,1.276-3.757-0.93-3.375c1.87-0.324,1.864,1.889,1.899,0.217 c0.045-2.142,0.598-4.303,1.052-6.383c2.251-10.312,5.205-20.708,8.957-30.57c6.953-18.275,17.341-36.511,29.835-51.576 c0.773-0.934,8.855-10.103,9.763-7.478c0.981,2.841-0.037,6.763-0.381,9.618c-0.687,5.705-1.749,11.369-2.88,17 c-2.087,10.396-4.667,20.704-7.605,30.891c-1.03,3.571-2.13,7.124-3.356,10.634c-0.409,1.173-0.841,2.342-1.34,3.479 c-0.154,0.353-0.329,0.694-0.511,1.033c-0.563,1.051,2.257,1.728,2.27,0.471c0.053-5.105,2.383-10.727,3.804-15.567 c1.173-3.994,2.405-7.974,3.692-11.934c0.631-1.94-2.177-2.991-3.198-1.348c-2.109,3.393-4.062,6.884-5.907,10.427 c-1.138,2.184-2.146,4.424-3.091,6.696c-0.398,0.958-0.721,1.91-1.238,2.814c1.045,0.9,1.394,0.902,1.046,0.005 c-0.04-0.504-0.045-1.008-0.015-1.513c0.12-5.475,2.956-10.592,4.802-15.605c0.54-1.47,0.674-3.032-1.005-3.724 c-2.887-1.188-7.604,8.16-8.646,9.747c-2.669,4.069-5.259,8.194-7.801,12.345c1.065,0.449,2.132,0.898,3.198,1.348 c1.291-3.535,2.667-7.04,4.05-10.54c1.272-3.219,2.654-6.397,3.872-9.636c0.365-0.971,0.736-2.121,0.167-3.085 c-0.302-0.511-0.902-0.897-1.511-0.867c-1.794,0.092-2.896,2.187-3.83,3.472c-2.621,3.61-4.992,7.41-7.456,11.128 c-1.087,1.64-2.188,3.269-3.318,4.878c-1.646,2.341-0.518,0.493-0.238,1.44c-0.228-0.772-0.133-1.723-0.122-2.516 c0.077-5.375,1.658-11.13,3.767-16.044c0.615-1.433,2.28-3.801,0.803-5.277c-1.386-1.386-3.272-0.105-4.511,0.781 c-5.994,4.293-11.083,9.854-16.734,14.574c-1.059,0.885-2.147,1.729-3.335,2.432c0.564-0.335,0.333,1.489,0.934-0.63 c0.299-1.051,0.747-2.089,1.171-3.089c1.883-4.454,4.221-8.706,6.249-13.094c0.537-1.161,1.453-3.783-0.615-4.167 c-1.982-0.368-3.439,1.778-4.583,3.074c-5.333,6.038-9.557,12.987-14.814,19.055c0.671,0.307,1.342,0.613,2.014,0.92 c0.008-0.333,0.048-0.663,0.119-0.989c0.118-0.691,0.298-1.375,0.466-2.055c0.448-1.814,1.015-3.602,1.574-5.384 c1.384-4.401,2.952-8.748,4.589-13.061c0.644-1.697,2.243-4.096,1.901-6c-0.295-1.642-2.228-1.728-3.277-0.808 c-4.592,4.022-7.782,10.826-10.797,16.002c-2.016,3.461-3.896,7.005-5.558,10.648c-0.675,1.481-1.276,2.996-1.806,4.534 c-0.315,0.918-0.575,1.853-0.897,2.769c0.646,0.283,1.292,0.566,1.938,0.849c-0.104-0.534-0.163-1.074-0.18-1.618 c-0.394-5.584,0.214-11.328,0.614-16.894c0.225-3.105,1.958-8.839,0.729-11.865c-0.385-0.947-1.563-1.774-2.571-1.046 c-1.965,1.421-2.43,5.706-3.144,7.812c-2.35,6.93-5.766,13.239-8.892,19.815c-1.719,3.613-3.139,7.37-4.966,10.932 c-0.249,0.484-0.531,0.947-0.824,1.405c-0.674,1.05,0.289,0.563,0.071,0.225c-1.042-1.619-1.389-3.864-1.835-5.698 c-5.694-23.367-4.229-49.223,3.9-71.919c-1.125-0.31-2.25-0.621-3.375-0.931c-3.968,15.305-12.039,30.072-19.958,43.64 c-3.768,6.455-7.818,12.988-12.965,18.448c-3.655,3.877-12.783,9.564-17.795,5.352c-0.567,0.975-1.135,1.95-1.702,2.925 c5.398,2.068,10.362,6.45,14.927,9.887c1.767,1.33,6.142,6.725,8.887,5.253c1.664-0.892,1.73-3.8,1.911-5.377 c0.441-3.858,0.406-7.788,0.404-11.665c-0.008-16.266-0.96-32.567-2.06-48.792c-0.133-1.966-2.819-2.389-3.438-0.465 c-4.984,15.507-11.947,31.148-21.361,44.508c-1.386,1.967-2.973,4.099-4.965,5.503c-1.358,0.958-2.175-2.861-3.037-4.135 c-2.25-3.322-5.968-3.395-7.781,0.268c-1.273,2.572-2.914,9.99-0.359,12.338c2.299,2.114,4.151-1.785,4.866-3.368 c3.224-7.141,5.363-14.881,7.535-22.396C107.613,63.192,104.236,62.271,103.61,64.436L103.61,64.436 M137.307,92.239c13.934-10.737,29.582-25.003,35.242-42.105c-1.125-0.31-2.25-0.621-3.375-0.931 c-1.483,6.818-2.766,13.685-3.911,20.567c-1.414,8.5-3.55,18.108-2.05,26.721c0.387,2.221,3.76,1.276,3.375-0.93 c-1.504-8.631,0.984-18.596,2.422-27.077c1.042-6.14,2.215-12.266,3.539-18.351c0.48-2.209-2.666-3.074-3.375-0.931 c-5.306,16.033-21.418,30.601-33.633,40.015C133.779,90.574,135.52,93.617,137.307,92.239L137.307,92.239z"/>
<path id="x" d="M83.55026,155.88916l-11.63005-14.36809l27.42699-21.98744h1.04005l6.7986,11.71976L83.55026,155.88916z
	 M60.35662,154.17789l-21.40593-17.02972l7.02455-12.63023h0.43862l20.52205,17.18589L60.35662,154.17789z M25.99814,103.45094
	c-6.01107-8.24072-8.32047-16.66419-6.86837-25.02454c2.49215-14.27837,15.23869-24.32341,17.94018-26.31049l17.9003,1.98708
	l21.49233-6.07421l20.8477,3.47573l4.38618,10.06165l4.127,19.19622l9.10135,2.36256l3.93095-7.82536l1.89404,1.89404
	l-5.57909,9.72272l-4.03728,0.27248l0.25918,3.72495l0.21931-0.0133l1.91065,10.15137l-0.88388,0.85397l1.29924,1.33912
	l-1.46871-1.15636c-0.08971,0.1163-9.5898,12.09856-22.49251,13.33136c-6.7122,0.64796-13.2782-1.76445-19.45874-7.15414
	c-6.0742-5.28004-9.16447-11.20141-9.18773-17.58797c-0.05317-12.59035,11.71976-23.19364,11.83606-23.29665l-2.47886-2.8045
	c-0.16947,0.15617-1.63485,1.46539-3.51892,3.64851c-0.84068-2.41572-2.58187-5.09063-6.17722-5.99778l-0.90714,3.62193
	c3.35942,0.84401,3.99741,4.71184,4.12701,6.16392c-3.32288,4.71185-6.65903,11.28115-6.63245,18.64131
	c0.02658,6.7986,2.94407,13.05556,8.6162,18.65128c-2.60845,1.42883-7.44987,3.72493-13.19844,4.78825
	C41.74191,116.19746,32.67047,112.60212,25.99814,103.45094z M69.31176,138.82289l-20.58518-17.23904l-0.93705-3.24313
	c9.73602-0.23592,18.28908-4.60883,21.33948-6.37327c5.92136,4.82813,12.18829,7.2937,18.67786,7.2937
	c0.83071,0,1.67472-0.03988,2.51873-0.1163c1.58501-0.15617,3.11685-0.46852,4.58223-0.85729L69.31176,138.82289z
	 M159.08244,164.26279c0-9.28078-8.60623-14.43454-9.08804-14.70702l-39.16003-19.45541l-8.30718-14.30495h-1.17963
	c8.04467-4.10043,13.29148-10.43713,13.96603-11.27782l13.2383-12.86615l4.47925-29.02196l-5.39967-23.45615h-8.45007
	l-3.64851-16.47146l-19.93723-6.52613L69.6507,18.19935l-9.41037-3.94756L53.34537,0l-4.80155,16.8104L33.4746,9.82573
	l2.90751,18.1329l-10.81262-7.307l8.78567,28.78936c-3.84124,2.88093-16.28871,13.25494-18.93705,28.31086
	c-1.64814,9.41038,0.88389,18.79417,7.52963,27.90547c6.2038,8.50323,13.70684,11.85268,20.88424,12.56378l0.741,2.57189h-0.83072
	l-8.5431,15.38158c-3.0371,1.29591-16.92338,7.23056-21.34945,9.18773c-5.86819,2.61179-6.88166,9.21765-6.91821,9.54329
	L0,214.26204l3.71165,0.42865l6.93151-59.30661c0-0.03987,0.41536-2.68488,2.26952-4.77496
	c1.38896,1.81429,3.72494,6.08751,3.72494,14.21193v49.647h3.73823v-49.66029c0-8.82555-2.5287-13.83644-4.3729-16.31531
	c4.72512-2.09009,16.70407-7.19069,20.24957-8.70924l25.31031,20.12996l2.55529-4.85472l5.16706,9.20435l-12.75982,54.9171h30.78971
	l-13.97931-54.08638l4.69853-10.08492l5.28337,6.52945l26.59626-27.72603l38.31602,19.02675c0,0,0.03987,0.0266,0.08971,0.06647
	c-3.11353,2.01033-7.94165,5.99777-7.94165,11.37086c0,6.54272-1.64815,49.70018-1.66144,50.12883l3.73824,0.14288
	c0.06313-1.77774,1.66144-43.66585,1.66144-50.27171c0-3.86783,4.51578-7.28374,7.24052-8.85214
	c1.92395,1.96049,3.99742,4.98431,3.99742,8.85214c0,8.3703,6.41313,47.72639,6.68562,49.40112l3.68837-0.59813
	C165.64844,212.65044,159.08244,172.33737,159.08244,164.26279z"/>
</svg>


              
            
!

CSS

              
                .svg {
  width: 350px;
  height: 350px;
  margin: 20px auto;
  display: block;
}

#x {
  display: none;
}

body {
  text-align: center;
  padding: 20px;
}
              
            
!

JS

              
                var button = document.getElementById("toggle");

var morph = new TimelineMax({paused:true});
morph.to("#gear", 1, { morphSVG: "#x" });

button.addEventListener("click", function() {
  if (button.classList.contains("open")) {
    morph.reverse(0);
    button.classList.remove("open");
  } else {
    morph.play(0);
    button.classList.add("open");
  }
})


              
            
!
999px

Console