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

              
                <div class="heading">
  <div id="triangle-box">
    <div class="content">
      <h1>Triangularize.js</h1>
      <h2>A jQuery Plugin that generates a triangular grid</h2>
      <br>
      <a href="#roadmap" class="caret" title="Roadmap"></a>
    </div>
    <div class="caption">
      <p>
        <strong>Author:</strong> Daniel Baliczek |
        <strong>GitHub:</strong> <a href="https://github.com/MrDev-io/Triangularize.js">Triangularize.js</a> |
        <strong>Created:</strong> 3/24/2019 | 
        <strong>Updated:</strong> 3/24/2019 | 
        v0.5.0</p>
    </div>
  </div>
</div>
<div class="container mt-5" id="roadmap">
  <h2>Roadmap:</h2>
  <h3>v1: The Triangle Grid</h3>
  <ul>
    <li>Adjust based on screen size</li>
    <li>Add option to show/hide either the upside down or rightside up triangle</li>
    <li>adjust amount of triangles generated with spacing</li>
    <li>Rename options to make them more intuitive</li>
  </ul>
  <h3>v2: Triangularize animations</h3>
  <ul>
    <li>Create Wave Function
      <ul>
        <li>add option for range of colors, in steps</li>
        <li>add duration option</li>
        <li>add width option?</li>
        <li>always, onclick</li>
      </ul>
    </li>
    <li>
      Create Sparkle Animation
      <ul>
        <li>add option for mutliple colors</li>
        <li>add frequency option</li>
        <li>add speed option</li>
      </ul>
    </li>
     <li>Create Ripple Animation
      <ul>
        <li>onclick</li>
        <li>random</li>
        <li>add dissipate option</li>
        <li>options for multiple colors</li>
        <li>add duration option</li>
        <li>add frequency option if random</li>
       </ul>
    </li>
    <li>Create Pulse Animation
      <ul>
        <li>Colors option</li>
        <li>Duration from change option</li>
        <li>random option</li>
      </ul>
    </li>
    <li>Allow Stacking of Animations, with prioriety being last</li>
    <li>Allow Animations to happen on events</li>
  </ul>
</div>
              
            
!

CSS

              
                .triangle, .upsdwn-triangle{
  position: absolute; 
} 

#triangle-box {
    overflow: hidden;
    background-color: #333;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    position: relative;
}

.heading {
    height: 100vh;
    text-align: center;
}

.content {
    position: relative;
    z-index: 4000;
    color: #F09909;
    top: 50%;
    transform: translate(0, -50%);
}

h1 {
    font-size: 4rem;
}

h1::after {
    content: "";
    width: 33%;
    height: 30px;
    background-color: #F09909;
}

.caption {
    text-align: center;
    z-index: 4000;
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 100%;
    padding: .5em;
    background-color: #333;
    color: #F09909;
}

.caption p {
    margin: 0;
    padding: 0;
    color: #F09909;
}

.caption a {
    text-decoration: underline;
    color: #F09909;
}

.caret {
    cursor: pointer;
    transform: rotate(-45deg);
    border-width: 0 3px 3px 0;
    display: inline-block;
    padding: 10px;
    border-bottom: 4px solid #F09909;
    border-left: 4px solid #F09909;
}
              
            
!

JS

              
                $.fn.trianglarize = function(options) {
    var settings = $.extend(
      {
        triHeight: 100,
        spacingV: 0,
        spacingH: 0,
        triColor: "#00DDFF",
        triColorU: "#DD00FF",
        startUpsdwn: false
      },
      options
    );
    var triHeight = settings.triHeight; 
    var startUpsdwn = settings.startUpsdwn;
    var spacingV = settings.spacingV;
    var spacingH = settings.spacingH;
    var triColor = settings.triColor;
    var triColorU = settings.triColorU;
  
    var triWidth = triHeight / Math.sqrt(3) * 2;
    triCountH = this.width() / triWidth + 1;
    triCountV = this.height() / triHeight;
    for (i = 0; i < triCountV; i++) {
      var upsdwn = startUpsdwn;
      var offset = 0;
      var hOffset = 0; 
      var offset = 0 - triWidth / 2; 
      for (j = 0; j < triCountH * 2; j++) {
        if (upsdwn) {
          var tmp = i * triHeight + spacingV*i;
          this.append(
            '<div class="upsdwn-triangle" style="top: ' +
              tmp +
              "px; left: " +
              ((j * (triWidth / 2)) + offset + (spacingH*j)) +
              'px;"></div>'
          );
        } else {
          var tmp = i * triHeight + spacingV*i; 
          this.append(
            '<div class="triangle" style="top: ' +
              tmp +
              "px; left: " +
              ((j * (triWidth / 2)) + offset + (spacingH*j)) +
              'px;"></div>'
          );
        }
        upsdwn = !upsdwn;
      }
      startUpsdwn = !startUpsdwn;
    }
    $(".triangle").css("border-left", triWidth / 2 + "px solid transparent");
    $(".triangle").css("border-right", triWidth / 2 + "px solid transparent");
    $(".triangle").css("border-bottom", triHeight + "px solid " + triColor);
    $(".upsdwn-triangle").css(
      "border-left",
      triWidth / 2 + "px solid transparent"
    );
    $(".upsdwn-triangle").css(
      "border-right",
      triWidth / 2 + "px solid transparent"
    );
    $(".upsdwn-triangle").css(
      "border-top",
      triHeight + "px solid " + settings.triColorU
    );
    return this;
  };
$(document).ready(function() {
  $("#triangle-box").trianglarize({
    triHeight: 12,
    triColor: '#252525',
    triColorU: '#404040',
    spacingV: 6,
    spacingH: 8
  });
});
              
            
!
999px

Console