Skip to content

Instantly share code, notes, and snippets.

View Sphinxxxx's full-sized avatar

Andreas Borgen Sphinxxxx

View GitHub Profile
//Replacement for
//https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getTotalLength
//Extracted from
//https://github.com/juliangarnier/anime/blob/master/anime.js
function getSvgTotalLength(el) {
function getDistance(p1, p2) {
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
}
@Sphinxxxx
Sphinxxxx / draggable-elements-boilerplate.markdown
Created October 11, 2017 05:00
Draggable elements boilerplate
@Sphinxxxx
Sphinxxxx / index.html
Last active October 3, 2017 19:16
Label placement using d3 force layout
<script src="//d3js.org/d3.v3.js"></script>
<label>
<input type="checkbox" onchange="toggleFreehand(this.checked)" />
Freehand
</label>
@Sphinxxxx
Sphinxxxx / 15-load-obj-file.markdown
Created September 13, 2017 20:08
15. Load .obj file
@Sphinxxxx
Sphinxxxx / index.html
Last active November 8, 2020 11:15
Simple SVG Editor
<script>console.clear();</script>
<h1>Simple SVG Editor</h1>
<button id="prettify">Prettify</button>
<textarea id="svgInput" class="svg-editor" >
<svg xmlns="http://www.w3.org/2000/svg" width="600" height="300" >
<!--http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands-->
<g stroke="black" stroke-width="2" fill="none" >
<path d="M90,90 v-80 a80,80 0 0,0 -80,80 z" fill="red" />
@Sphinxxxx
Sphinxxxx / procedural-city.markdown
Last active October 7, 2018 17:18
Procedural City
@Sphinxxxx
Sphinxxxx / drag-rotate.markdown
Last active September 5, 2017 23:08
Drag Rotate
@Sphinxxxx
Sphinxxxx / index.pug
Last active November 7, 2017 00:51
three.js praxinoscope
#container
@Sphinxxxx
Sphinxxxx / index.html
Created August 20, 2017 13:00
Swipeable carousel
<div id="main">
<!-- Carousel -->
<div class="carousel-main carousel-1" data-slide-index="2">
<!-- Slides -->
<div class="carousel-item" data-slide-index="0">
<img src="https://www.fillmurray.com/810/400" />
</div>
<div class="carousel-item" data-slide-index="1">
<img src="https://www.fillmurray.com/620/800" />