Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

HTML

              
                <div>
  <button id="btn1">Tween Simple Bezier</button> <button id="btn2">Tween Simple Bezier Curviness 1.5</button> <button id="btn3">Tween Quadratic Bezier</button>
</div>

<canvas id="myCanvas" width="220" height="220" style="border:1px solid #d3d3d3; background:#fff;margin-top:24.5px;">
Your browser does not support the HTML5 canvas tag.</canvas>

<div>
<canvas id="myCanvas2" width="220" height="220" style="border:1px solid #d3d3d3; background:#fff;margin-top:24.5px;">
Your browser does not support the HTML5 canvas tag.</canvas>
</div>

<div class="div2" id="div2"></div>
<div class="div3" id="div3"></div>
<div class="div1" id="div1"></div>
              
            
!

CSS

              
                .div1, .div2{
	width:20px;
	height:20px;
	position:absolute;
	top:48px;
	left:450px;
	background:#00f;
	border-radius:50%;
}
.div2, .div3{
  width:20px;
  height:20px;
  position:absolute;
  top:60px;
  left:108px;
  border-radius:50%;
  background:#F00;
}
.div3{
  top:310px;
}
              
            
!

JS

              
                $(document).ready(function(){

var btn1 = $("#btn1"),
    btn2 = $("#btn2"),
    btn3 = $("#btn3"),
    div1 = $("#div1"),
    div2 = $("#div2"),
    div3 = $("#div3"),
    tn1 = TweenMax.to([div1,div2,div3], 2, {bezier:[{x:100, y:100}, {x:0, y:200}, {x:-100, y:100}, {x:0, y:0}]/*bezier end*/, ease:Linear.easeNone, paused:true}),
    tn2 = TweenMax.to([div1,div2,div3], 2, {bezier:{curviness:1.5, values:[{x:100, y:100}, {x:0, y:200}, {x:-100, y:100}, {x:0, y:0}]}/*bezier end*/, ease:Linear.easeNone, paused:true}),
    tn3 = TweenMax.to([div1,div2,div3], 2, {bezier:{type:'quadratic', values:[/*p1*/{x:0, y:0},{x:100, y:0},{x:100, y:100},  /*p2*/{x:100, y:200},{x:0, y:200},  /*p3*/{x:-100, y:200},{x:-100, y:100},  /*p4*/{x:-100, y:0},{x:0, y:0}]}/*bezier end*/, ease:Linear.easeNone, paused:true});

btn1.click(function() {
	tn1.play(0);
});

btn2.click(function() {
	tn2.play(0);
});
  
btn3.click(function() {
  tn3.play(0);
});  

});

/*CANVAS ELEMENT*/

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.moveTo(110,10);
ctx.quadraticCurveTo(210,10,210,110);
ctx.quadraticCurveTo(210,210,110,210);
ctx.quadraticCurveTo(10,210,10,110);
ctx.quadraticCurveTo(10,10,110,10);
ctx.strokeStyle = '#000';
ctx.stroke();

ctx.beginPath();
ctx.moveTo(110,10);
ctx.arc(110, 10, 5, 0, Math.PI*2, true);
ctx.fillStyle = '#000';
ctx.fill();

ctx.beginPath();
ctx.moveTo(210,110);
ctx.arc(210, 110, 5, 0, Math.PI*2, true);
ctx.fillStyle = '#000';
ctx.fill();

ctx.beginPath();
ctx.moveTo(110,210);
ctx.arc(110, 210, 5, 0, Math.PI*2, true);
ctx.fillStyle = '#000';
ctx.fill();

ctx.beginPath();
ctx.moveTo(10,110);
ctx.arc(10, 110, 5, 0, Math.PI*2, true);
ctx.fillStyle = '#000';
ctx.fill();

/*SECOND CANVAS*/
var c2 = document.getElementById("myCanvas2");
var ctx2 = c2.getContext("2d");
ctx2.beginPath();
ctx2.arc(110, 110, 100, 0, Math.PI*2, true);
ctx2.strokeStyle = '#000';
ctx2.stroke();

ctx2.beginPath();
ctx2.moveTo(110,10);
ctx2.arc(110, 10, 5, 0, Math.PI*2, true);
ctx2.fillStyle = '#000';
ctx2.fill();

ctx2.beginPath();
ctx2.moveTo(210,110);
ctx2.arc(210, 110, 5, 0, Math.PI*2, true);
ctx2.fillStyle = '#000';
ctx2.fill();

ctx2.beginPath();
ctx2.moveTo(110,210);
ctx2.arc(110, 210, 5, 0, Math.PI*2, true);
ctx2.fillStyle = '#000';
ctx2.fill();

ctx2.beginPath();
ctx2.moveTo(10,110);
ctx2.arc(10, 110, 5, 0, Math.PI*2, true);
ctx2.fillStyle = '#000';
ctx2.fill();
              
            
!
999px

Console