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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <div class="coordinate-pane">
  <div class="coordinate-pane__inner">
    <svg xmlns="" viewBox="0 0 218 218">
      <line x1="20" y1="144" x2="198" y2="72" stroke="#9E9E9E"/>
        <circle cx="20" cy="144" r="10" fill="#8A81AE"/>
        <text x="20" y="144" font-size="8" stroke-width="1" text-anchor="middle" dy="2.5em">A</text>
        <circle cx="198" cy="72" r="10" fill="#8A81AE"/>
        <text x="198" y="72" font-size="8" stroke-width="1" text-anchor="middle" dy="2.5em">B</text>
        <circle cx="20" cy="144" r="4" fill="#000"/>
        <text x="20" y="144" font-size="6" stroke-width="1" text-anchor="middle" dy="2em">P</text>

<button class="interpolate-btn">Interpolating</button>


body {
  padding: 0;
  margin: 0;

.coordinate-pane {
  width: 218px;
  height: 218px;
  margin-top: 10px;
  margin-left: 10px;
  border: 1px solid #ebebeb;

  &__inner {
    position: relative;
    width: 100%;
    height: 100%;

button {
  margin-left: 10px;



                const controlPointA = document.getElementsByTagName('circle')[0];
const controlPointB = document.getElementsByTagName('circle')[1];
const midpoint = document.getElementsByTagName('circle')[2];
const midpointText = document.getElementsByTagName('text')[2];
const interpolateBtn = document.getElementsByClassName('interpolate-btn')[0];
const Ax = parseInt(controlPointA.getAttribute('cx'), 10);
const Ay = parseInt(controlPointA.getAttribute('cy'), 10);
const Bx = parseInt(controlPointB.getAttribute('cx'), 10);
const By = parseInt(controlPointB.getAttribute('cy'), 10);

function blender(A, B, t) {
    if (t === 0) {
        return A;

    if (t === 1) {
        return B;

    return ((1 - t) * A) + (t * B); // or A + t * (B - A)

function interpolator(Ax, Bx, Ay, By, duration) {
  return function(update) {
    const blendX = blender.bind(null, Ax, Bx);
    const blendY = blender.bind(null, Ay, By);
    let startTime = 0;
    function step(timestamp) {
      if (!startTime) {
        startTime = timestamp;

      const pastTime = timestamp - startTime;
      let progress = pastTime / duration;
      if (progress > 1) {
        update(blendX(1), blendY(1));

      update(blendX(progress), blendY(progress));


const interpolate = interpolator(Ax, Bx, Ay, By, 1000);

interpolateBtn.addEventListener('click', function() {
  interpolate(function(x, y) {
    // do interpolating.
    midpoint.setAttribute('cx', x);
    midpoint.setAttribute('cy', y);
    midpointText.setAttribute('x', x);
    midpointText.setAttribute('y', y);