Skip to content

Instantly share code, notes, and snippets.

@THEFIG06
Created July 16, 2024 01:09
Show Gist options
  • Select an option

  • Save THEFIG06/ffe247a2b48e0b71d05a9d1668f4f332 to your computer and use it in GitHub Desktop.

Select an option

Save THEFIG06/ffe247a2b48e0b71d05a9d1668f4f332 to your computer and use it in GitHub Desktop.

Revisions

  1. THEFIG06 created this gist Jul 16, 2024.
    7 changes: 7 additions & 0 deletions draggable.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Draggable
    ---------


    A [Pen](https://codepen.io/GreenSock/pen/ExEwMEK) by [GSAP](https://codepen.io/GreenSock) on [CodePen](https://codepen.io).

    [License](https://codepen.io/license/pen/ExEwMEK).
    5 changes: 5 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    <div class="box green">drag me</div>

    <div class="box purple">flick me</div>

    <div class="box orange">spin me</div>
    5 changes: 5 additions & 0 deletions script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    Draggable.create(".green", { bounds: "body" });

    Draggable.create(".purple", { inertia: true, bounds: "body" });

    Draggable.create(".orange", { inertia: true, type: "rotation", bounds: "body" });
    3 changes: 3 additions & 0 deletions scripts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/gsap-latest-beta.min.js"></script>
    <script src="https://unpkg.com/gsap@3/dist/Draggable.min.js"></script>
    <script src="https://assets.codepen.io/16327/InertiaPlugin.min.js"></script>
    26 changes: 26 additions & 0 deletions style.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    /* Global styles come from external css https://codepen.io/GreenSock/pen/gOWxmWG */


    body {
    display: flex;
    align-items: center;
    justify-content: space-around;
    min-height: 100vh;
    margin: 0;
    }

    .box {
    display: block;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: var(--color-just-black)
    }

    h1 {
    position: fixed;
    width: 100%;
    text-align: center;
    top: 0;
    }
    1 change: 1 addition & 0 deletions styles
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <link href="https://codepen.io/GreenSock/pen/gOWxmWG.css" rel="stylesheet" />