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

+ add another resource


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


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.


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.


                <!--control btn-->
<button onclick="pause()">Pause</button>
<button onclick="play()" >Play</button>
<button onclick="restart()">Restart</button>
<button onclick="reverse()">Reverse</button>
<button onclick="once()">loop once</button>
<button onclick="infinity()">loop infinity</button>
<button onclick="timeScale(1)">speed 1x</button>
<button onclick="timeScale(4)">speed 4x</button>
<button onclick="timeScale(10)">speed 10x</button>

<!--method 1-->
<div class="character"></div>
#1 - background position tween 

<!--method 2-->
<div class="container">
<img class="character2" src="" >
#2 - img/div 'x' tween . i prefer this one , check Chrome > Rendering > show paint rectangles 



  background-color: #333;

.character {
  background: url(;
  width: 150px;  height:150px; 

.container {
  width: 150px;  height:150px;  overflow:hidden;

  color: #fff;



                /* a Pen by Diaco m.lotfollahi  : */

// you can use this methods even in GSAP timelines :

// method 1 ( div background position ) :
var M1 ='.character',1,{repeat:-1,backgroundPosition: "-2400px",ease:SteppedEase.config(16)});

// method 2 ( img/div tag x position ) :
var M2 ='.character2',1,{repeat:-1,x:-2250,ease:SteppedEase.config(15)});

// Control functions ( you can add whatever you want ) : 

function play(){;; };

function pause(){ M1.pause(); M2.pause(); };

function restart(){ M1.restart(); M2.restart(); };

function reverse(){ M1.reverse(); M2.reverse(); };

function once(){ M1.repeat(1); M2.repeat(1); };

function infinity(){ M1.repeat(-1); M2.repeat(-1); };

function timeScale(X){[M1,M2],1,{timeScale:X});
  //M1.timeScale(X); M2.timeScale(X); 

/* a Pen by Diaco m.lotfollahi  : */