cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In  -->
<div id="container">
 <!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In  -->
<svg id="line-svg-node" version="1.1"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
	 x="0px" y="0px" width="100%" height="100%"  enable-background="new 0 0 400 400"
	 xml:space="preserve">
<defs>
</defs>
<path id="l0" fill="none" stroke="#FCE4EC" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
	M400,200 Q500,200 600,200 "/>
  <circle id="p0" cx="0" cy="0" r="14" fill="rgba(0,0,0,0)" stroke-linecap="round" stroke-width="6" stroke="#FCE4EC"></circle>
  <circle id="p1" cx="0" cy="0" r="14" fill="rgba(0,0,0,0)" stroke-linecap="round" stroke-width="6" stroke="#FCE4EC"></circle>
</svg>

</div>

<div id="null-object"></div>
<div id="p0-null-object"></div>
<div id="p1-null-object"></div>
            
          
!
            
              body{
  background-color:#E91E63;
  overflow:hidden;
}
body, html, #container {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

#null-object, #p0-null-object, #p1-null-object{
  position:absolute;
  width:8px;
  height:8px;
  background-color:rgba(136,14,79,0);
  border-radius:50%;
}

            
          
!
            
              var container = document.getElementById('container');
var nullObject = document.getElementById('null-object');
var p0NullObject = document.getElementById('p0-null-object');
var p1NullObject = document.getElementById('p1-null-object');
var lineSVGNode = document.getElementById('line-svg-node');
var l0 = document.getElementById('l0');
var p0 = document.getElementById('p0');
var p1 = document.getElementById('p1');

TweenMax.set(container, {
  position:'absolute',
  top:'50%',
  left:'50%',
  xPercent:-50,
  yPercent:-50
})

TweenMax.set([p0,p1], {
  drawSVG:'40 90',
  transformOrigin:'50% 50%'
})

TweenMax.set(lineSVGNode, {
  position:'absolute'
})
TweenMax.set([p0, p1], {
  position:'absolute',
  scale:1
})

TweenMax.set(nullObject, {
  position:'absolute',
  x:0,
  y:0
})
TweenMax.set(p0NullObject, {
  position:'absolute',
  x:0,
  y:400
})
TweenMax.set(p1NullObject, {
  position:'absolute',
  x:0,
  y:400
})

function point0Update(e){
  
    //move point0
    TweenMax.set(p0, {
      attr:{cx:p0NullObject._gsTransform.x,
            cy:p0NullObject._gsTransform.y
           }
    })
    
	p0cX = p0NullObject._gsTransform.x;   
  p0cY = p0NullObject._gsTransform.y;     
  p1cX = p1NullObject._gsTransform.x;   
  p1cY = p1NullObject._gsTransform.y;     

  updateLine();

}

function point1Update(e){
  
    //move point1
    TweenMax.set(p1, {
      attr:{cx:p1NullObject._gsTransform.x,
            cy:p1NullObject._gsTransform.y
           }
    })
    
	p0cX = p0NullObject._gsTransform.x;   
  p0cY = p0NullObject._gsTransform.y;     
  p1cX = p1NullObject._gsTransform.x;   
  p1cY = p1NullObject._gsTransform.y;     
    
  updateLine();
  
}

function updateLine(){
  nullX = nullObject._gsTransform.x;
  nullY = nullObject._gsTransform.y;
  
  TweenMax.set(l0, {
    attr:{d:"M" + p0cX + "," +p0cY +" Q" + nullX + "," + nullY + " " + p1cX + ","+ p1cY  }
  })  
  
  
}

function initPoints(){
    TweenMax.set(p0, {
      attr:{cx:p0NullObject._gsTransform.x,
            cy:p0NullObject._gsTransform.y
           }
    })  
      TweenMax.set(p1, {
      attr:{cx:p1NullObject._gsTransform.x,
            cy:p1NullObject._gsTransform.y
           }
    })  
  point0Update();
  point1Update();
  updateLine();
}


var tl = new TimelineMax({repeat:-1, repeatDelay:2, yoyo:true});
tl.timeScale(3)

.to(p1NullObject, 2, {
  bezier:{type:'thru', values:[
    {x:0, y:400}, {x:300, y:400}]},
  ease:Power3.easeInOut,
  onUpdate:point1Update
})
.to(nullObject, 2, {
  x:0,
  y:0,
  ease:Back.easeOut,
  onUpdate:updateLine
}, '-=2')

tl.to(p0NullObject, 2, {
  bezier:{type:'cubic', values:[
    {x:0, y:400}, {x:200, y:0},
  {x:400, y:0}, {x:600, y:400}]},
  ease:Power4.easeInOut,
  onUpdate:point0Update
})
.to(nullObject, 2, {
  x:450,
  y:0,
  ease:Back.easeIn.config(0.6),
  onUpdate:updateLine
}, '-=2')

.to(p1NullObject, 2, {
  bezier:{type:'cubic', values:[
    {x:300, y:400}, {x:500, y:0},
  {x:700, y:0}, {x:900, y:400}]},
  ease:Power4.easeInOut,
  onUpdate:point1Update
})
.to(nullObject, 2, {
  x:750,
  y:0,
  ease:Back.easeOut,
  onUpdate:updateLine
}, '-=2')

.to(p0NullObject, 2, {
  bezier:{type:'cubic', values:[
    {x:600, y:400}, {x:800, y:0},
  {x:1000, y:0}, {x:1200, y:400}]},
  ease:Power4.easeInOut,
  onUpdate:point0Update
})
.to(nullObject, 2, {
  x:1050,
  y:0,
  ease:Back.easeIn.config(0.3),
  onUpdate:updateLine
}, '-=2')

.to(p1NullObject, 2, {
  bezier:{type:'cubic', values:[
    {x:900, y:400}, {x:1100, y:0},
  {x:1300, y:0}, {x:1500, y:400}]},
  onUpdate:point1Update
})
.to(nullObject, 2, {
  x:1350,
  y:0,
  ease:Power1.easeOut,
  onUpdate:updateLine
}, '-=2')

.to(p0NullObject, 2, {
  bezier:{type:'thru', values:[
    {x:1200, y:0}, {x:1500, y:0}
  ]},
  ease:Power2.easeOut,
  onUpdate:point0Update
})
.to(nullObject, 2, {
  x:1500,
  y:0,
  ease:Back.easeOut.config(2),
  onUpdate:updateLine
}, '-=2')


initPoints();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console