Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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.


                <div id="trigger">
  <div id="hover" class="project-title">
    <div class="title-line-wrap">
      <p id="title"> Project Title</p>
      <div id="line"></div>



                body {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  font-family: Arial;
  font-size: 2em;
  line-height: 0em;
  height: 100vh;
  margin: 0;

#trigger {
  position: relative;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  height: 200px;
  width: 400px;
  padding: 0 0 25px 25px;
  background-color: black;

.project-title {
  height: auto;
  width: auto;

.title-line-wrap {
  position: relative;
  display: flex;
  flex-direction: column;

#title {
  cursor: pointer;
  color: white;

#line {
  height: 3px;
  background-color: white;



                const lineTween = gsap.from('#line', {scaleX: 0, transformOrigin: '0% 50%', ease: 'none', paused: true});

const trigger = document.querySelector('#trigger');
const hover = document.querySelector('#hover');

// Get the dimensions we need
let triggerRect = trigger.getBoundingClientRect();
triggerRect.right = triggerRect.left + triggerRect.width;
triggerRect.bottom = + triggerRect.height;

let rect = hover.getBoundingClientRect();
rect.right = rect.left + rect.width;
rect.bottom = + rect.height;
rect.centerX = rect.left + rect.width / 2;
rect.centerY = + rect.height / 2;
rect.maxX = triggerRect.right - rect.centerX;
rect.maxY = rect.centerY -;
rect.maxDistance = Math.sqrt(Math.pow(rect.maxX, 2) + Math.pow(rect.maxY, 2));

// Add our listeners
trigger.addEventListener("mouseleave", out);
trigger.addEventListener('mousemove', move);

// Change progress back to 0 on leave
function out() {, {
    progress: 0,
    duration: 0.2,
    overwrite: 'auto'

// Change the progress based on the distance to the title
function move(e) {
  // If hovering the element, set progress to 1
  const inRect = (e.pageX > rect.left && e.pageX < rect.right && e.pageY > && e.pageY < rect.bottom);
  let progress = 1;
  if(!inRect) {
    // Circular distance from center of title
    const dist = Math.sqrt(Math.pow(e.pageX - rect.right, 2) + Math.pow(e.pageY -, 2)); 
    progress = 1 - dist / rect.maxDistance;
  // Update tween's progress, {
    progress: progress,
    duration: 0.2,
    overwrite: 'auto'