css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
      <svg id="mySVG" width="640" height="640" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" stroke="black">
        <pattern id="rwp" width="64" height="64" patternUnits="userSpaceOnUse" patternTransform="rotate(0) scale(5)">
              <path class="G1" d="M64,44L64,64L44,64C44,63.71 44.12,61.9 44.17,61.49L44.18,61.49C47.23,61.46 50.08,60.65 52.56,59.25C55.36,57.68 57.69,55.36 59.25,52.56C60.65,50.08 61.46,47.22 61.49,44.18C61.69,44.15 63.7,44 64,44"/>
              <path class="G1" d="M64,0L64,20C63.7,20 61.9,19.88 61.49,19.83C61.46,16.78 60.65,13.92 59.25,11.44C57.68,8.64 55.36,6.32 52.56,4.75C50.08,3.35 47.23,2.54 44.18,2.51L44.17,2.51C44.16,2.45 44,0.3 44,0L64,0Z"/>
              <path class="G1" d="M20,64.001L0,64.001L0,44.001C0.3,44.001 2.31,44.15 2.51,44.181C2.54,47.221 3.35,50.081 4.75,52.561C6.31,55.361 8.64,57.681 11.44,59.251C13.92,60.65 16.77,61.461 19.82,61.49L19.83,61.49C19.88,61.9 20,63.711 20,64.001"/>
              <path class="G1" d="M20,0C20,0.253 19.84,2.45 19.83,2.51L19.82,2.51C16.77,2.54 13.92,3.35 11.44,4.75C8.64,6.32 6.32,8.64 4.75,11.44C3.35,13.92 2.54,16.78 2.51,19.83C2.1,19.88 0.3,20 0,20L0,0L20,0Z"/>
            <path d="M48,64L32,64L20,64C20,52.962 11.038,44 0,44L0,20C11.038,20 20,11.038 20,0L44,0C44,11.038 52.962,20 64,20L64,44C53.005,44 44.07,52.892 44,63.871L48,64ZM32,11.979C43.05,11.979 52.021,20.95 52.021,32C52.021,43.05 43.05,52.021 32,52.021C20.95,52.021 11.979,43.05 11.979,32C11.979,20.95 20.95,11.979 32,11.979Z" class="G3"/>
              <path class="G2" d="M59.25,52.56C57.69,55.36 55.36,57.68 52.56,59.25C52.006,57.287 50.073,54.389 48.248,52.098C48.195,52.031 46.77,50.33 46.21,49.76C45.65,49.21 44.92,48.57 44.11,47.92C44.32,47.76 38.77,44.01 36.75,43.44C38.32,40.64 40.64,38.32 43.44,36.75C44.01,38.77 46.03,41.78 47.9,44.09C47.88,44.12 49.77,46.23 49.79,46.25C50.36,46.8 51.85,48.13 51.9,48.1C54.22,49.96 57.23,51.99 59.25,52.56"/>
              <path class="G2" d="M11.44,59.251C8.639,57.691 6.32,55.361 4.75,52.561C6.77,51.991 9.78,49.961 12.1,48.091C12.929,47.421 13.669,46.771 14.24,46.211C14.79,45.651 16.129,44.151 16.089,44.101C17.96,41.781 19.99,38.771 20.56,36.751C23.36,38.321 25.679,40.641 27.25,43.441C25.23,44.011 22.219,46.031 19.91,47.901C19.879,47.881 17.75,49.791 17.75,49.791C17.2,50.361 15.87,51.851 15.9,51.901C14.04,54.221 12.009,57.231 11.44,59.251"/>
              <path class="G2" d="M52.56,4.751C55.361,6.311 57.68,8.641 59.25,11.441C57.23,12.011 54.22,14.041 51.9,15.911C51.071,16.581 50.331,17.231 49.76,17.791C49.21,18.351 47.871,19.851 47.911,19.901C46.04,22.221 44.01,25.231 43.44,27.251C40.64,25.681 38.321,23.361 36.75,20.561C38.77,19.991 41.781,17.971 44.09,16.101C44.121,16.121 44.121,16.101 44.111,16.091C44.93,15.421 45.64,14.801 46.21,14.251C46.21,14.251 48.13,12.151 48.1,12.101C49.96,9.781 51.991,6.771 52.56,4.751"/>
              <path class="G2" d="M4.75,11.44C6.31,8.64 8.64,6.32 11.44,4.75C12.01,6.77 14.04,9.78 15.91,12.1C16.58,12.93 17.23,13.67 17.79,14.24C18.35,14.79 19.08,15.43 19.89,16.08C19.68,16.24 25.23,19.99 27.25,20.56C25.68,23.36 23.36,25.68 20.56,27.25C19.99,25.23 16.1,19.88 16.09,19.89C15.42,19.07 14.8,18.36 14.25,17.79C14.24,17.78 12.92,16.57 12.1,15.91C12.15,15.87 12.15,15.87 12.1,15.9C9.78,14.04 6.77,12.01 4.75,11.44"/>
              <path class="G1" d="M52,32C52,32.3 51.83,34.51 51.83,34.51L51.82,34.51C48.77,34.54 45.92,35.35 43.44,36.75C40.64,38.32 38.32,40.64 36.75,43.44C35.35,45.92 34.54,48.78 34.51,51.83C34.1,51.88 32.3,52 32,52C31.7,52 29.9,51.88 29.49,51.83C29.46,48.78 28.65,45.92 27.25,43.44C25.68,40.64 23.36,38.32 20.56,36.75C18.08,35.35 15.23,34.54 12.18,34.51L12.17,34.51L12.17,34.48C12.12,34.08 12,32.3 12,32C12,31.71 12.12,29.9 12.17,29.49L12.18,29.49C15.23,29.46 18.08,28.65 20.56,27.25C23.36,25.68 25.69,23.36 27.25,20.56C28.65,18.08 29.46,15.22 29.49,12.18C29.69,12.15 31.7,12 32,12C32.3,12 34.31,12.15 34.51,12.18C34.54,15.22 35.35,18.08 36.75,20.56C38.31,23.36 40.64,25.68 43.44,27.25C45.92,28.65 48.77,29.46 51.82,29.49L51.83,29.49C51.88,29.9 52,31.71 52,32"/>
      <rect x="0" y="0" width="640" height="640" fill="darkgreen" stroke="none"/>
      <rect x="0" y="0" width="640" height="640" fill="url(#rwp)" stroke="black" stroke-width="10"/>
      <div id="controller">
        <h2>Playing with scale and rotate on the pattern</h2>
        <label style="text-align:left;">Rotation in degree: <span id="lblRotation">0°</span></label>
        <input id="myRotation" type="range" min="0" max="360" step="1" value="0" onchange="fChangeAngle()" oninput="fChangeAngle()"/>
        <label style="text-align:left;">Scale factor: <span id="lblScale">5x</span></label>
        <input id="myScale" type="range" min="1" max="10" step="0.5" value="5" onchange="fChangeAngle()" oninput="fChangeAngle()"/>
        <label style="text-align:left;">Stroke: (<span id="btnStroke">on</span>)</label>
        <input id="myStroke" type="range" min="0" max="1" step="1" value="1" onchange="fEnableStrokes()" oninput="fEnableStrokes()"/>
  font-family: Raleway, sans-serif;
  font-weight: 200;
  font-weight: 500;
  fill: #FCEA0D;
  fill: #DFDB00;
  fill: #B1DB00;
  fill-rule: evenodd;
  clip-rule: evenodd;
  stroke-linejoin: round;
  stroke-miterlimit: 1.41421;
  stroke-width: 1;
  width: 580px;
  height: 160px;
  margin: 20px;
  padding: 25px;
  border: 5px solid black;
  font-weight: 400;
  text-align: left;
#myRotation, #myScale{
  width: 100%;
  width: 5%;
#lblRotation, #lblScale, #btnStroke{
  color: darkgreen;
  font-weight: 500;
  fill: darkgreen;
  font-family: Raleway;
  font-weight: 200;
  font-size: 2em;
#inlineRotation, #inlineScale{
  font-weight: 400;
              function fChangeAngle() {
  //reference slider values
  var angle = document.getElementById('myRotation').value;
  var scale = document.getElementById('myScale').value;
  //create string as value for the patternTransform attribute
  var myvalsp = "rotate("+ angle +") scale("+ scale +")";
  //modify patternTransform attribute with rotate and scale function
  document.getElementById("rwp").setAttribute("patternTransform", myvalsp);
  //refresh label with current rotation angle and scale factor
  document.getElementById("lblRotation").innerHTML = angle+"°";
  document.getElementById("lblScale").innerHTML = scale+"x";
function fEnableStrokes(){
    //reference slider values
  var strokestate = document.getElementById('myStroke').value;
  if (strokestate == 1) {
    document.getElementById("btnStroke").innerHTML = "on";
    document.getElementById("mySVG").setAttribute("stroke", "black");
  } else{
    document.getElementById("btnStroke").innerHTML = "off";
    document.getElementById("mySVG").setAttribute("stroke", "none");
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................