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.
Draggable
<div class="box green">drag me</div>
<div class="box purple">flick me</div>
<div class="box orange">spin me</div>
Draggable.create(".green", { bounds: "body" });
Draggable.create(".purple", { inertia: true, bounds: "body" });
Draggable.create(".orange", { inertia: true, type: "rotation", bounds: "body" });
<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>
/* 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;
}
<link href="https://codepen.io/GreenSock/pen/gOWxmWG.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment