Skip to content

Instantly share code, notes, and snippets.

@daybrush
Created August 7, 2019 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daybrush/2a0f1f48e7c245ba4a2bbf7601385c73 to your computer and use it in GitHub Desktop.
Save daybrush/2a0f1f48e7c245ba4a2bbf7601385c73 to your computer and use it in GitHub Desktop.
Moveable Vanilla Demo
<div class="label"></div>
<div class="page main">
<div class="container">
<div class="moveable"><span>Moveable</span></div>
<div class="buttons able">
<a href="#" data-able="scalable" [class]="scalable ? 'selected' : ''" (click)="clickScalable()" >Scalable</a>
<a href="#" data-able="resizable" [class]="resizable ? 'selected' : ''" (click)="clickResizable()">Resizable</a>
<a href="#" data-able="warpable" [class]="warpable ? 'selected' : ''" (click)="clickWarpable()">Warpable</a>
</div>
<p align="middle">Moveable is Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable</p>
<p align="middle">
<a href="https://github.com/daybrush/moveable" target="_blank"><strong>About Moveable</strong></a> /
<a href="https://daybrush.com/moveable/release/latest/doc/" target="_blank"><strong>API</strong></a> /
<a href="https://github.com/daybrush/scenejs-timeline" target="_blank"><strong>Main Project</strong></a>
</p>
<ngx-moveable
[target]="target"
[draggable]="true"
[origin]="false"
[rotatable]="true"
[pinchable]="true"
[scalable]="scalable"
[resizable]="resizable"
[warpable]="warpable"
[keepRatio]="false"
[throttleDrag]="1"
[throttleScale]="0.01"
[throttleRotate]="0.2"
[throttleResize]="1"
>
</ngx-moveable>
</div>
</div>
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600&display=swap");
html, body {
font-family: "Open Sans", sans-serif;
position: relative;
margin: 0;
padding: 0;
height: 100%;
color: #333;
letter-spacing: 1px;
background: #f5f5f5;
font-weight: 300;
}
a {
text-decoration: none;
color: #333;
}
.page {
position: relative;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.page:nth-child(2n) {
background: #f0f0f0;
}
.container {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.moveable {
font-family: "Roboto", sans-serif;
position: relative;
width: 250px;
height: 200px;
text-align: center;
font-size: 40px;
margin: 0px auto;
font-weight: 100;
letter-spacing: 1px;
}
.moveable span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
white-space: nowrap;
}
.description {
text-align: center;
}
.badges {
padding: 10px;
text-align: center;
}
.badges img {
height: 20px;
}
.buttons.able a {
min-width: auto;
padding: 8px 20px;
}
.buttons {
text-align: center;
margin: 0;
padding: 10px;
}
.buttons a {
margin: 0;
position: relative;
text-decoration: none;
color: #333;
border: 1px solid #333;
padding: 12px 30px;
min-width: 140px;
text-align: center;
/* font-weight: 400; */
display: inline-block;
box-sizing: border-box;
margin: 5px;
transition: all ease 0.5s;
}
.buttons a:hover, .buttons a.selected {
background: #333;
color: #fff;
}
.page.main {
z-index: 1;
min-height: 700px;
}
.label {
position: fixed;
top: 0;
left: 0;
padding: 5px;
border-radius: 5px;
background: #333;
z-index: 10;
color: #fff;
font-weight: bold;
font-size: 12px;
display: none;
transform: translate(-100%, -100%);
}
.page.feature, .page.footer {
height: auto;
text-align: left;
padding: 60px 20px;
}
.page.feature .container, .page.footer .container {
top: 0;
left: 0;
padding: 60px 0px;
margin: auto;
transform: none;
width: auto;
max-width: 800px;
}
.page.feature .container {
display: flex;
}
.page.footer .container {
padding: 0px;
}
.page.feature h2.container {
padding: 10px 0px;
font-weight: 300;
font-size: 40px;
}
.feature .container .left {
position: relative;
width: 300px;
height: 205px;
display: inline-block;
vertical-align: top;
z-index: 2000;
margin-bottom: 20px;
}
.feature .container .right {
position: relative;
display: inline-block;
vertical-align: top;
flex: 1;
}
.feature .right .description {
text-align: left;
margin: 0px 0px 10px;
}
.feature .right .description strong {
font-weight: 600;
}
.draggable, .resizable, .scalable, .rotatable, .origin, .warpable, .pinchable {
position: absolute;
left: 0;
}
.origin {
transform-origin: 30% 50%;
}
pre {
position: relative;
border: 1px solid #ccc;
box-sizing: border-box;
padding: 10px;
max-width: 500px;
}
code.hljs {
padding: 0;
}
.tab {
padding: 10px 12px;
appearance: none;
-webkit-appearance: none;
background: transparent;
border: 1px solid #ccc;
box-shadow: none;
font-weight: bold;
margin: 0;
cursor: pointer;
outline: none;
}
.tab.selected {
background: #333;
color: #fff;
border: 1px solid #333;
}
.panel {
display: none;
}
.panel.selected {
display: block;
}
.page.footer {
font-weight: 400;
}
.page.footer a {
text-decoration: underline;
}
.page.footer span:first-child:before {
content: "";
}
.page.footer span:before {
content: "/";
}
@media screen and (max-width: 750px) {
.page.feature .container {
display: block;
}
.page.feature .container {
text-align: center;
}
.page.feature .left, .page.feature .right {
display: block;
margin: 0px auto 20px;
}
.page.feature .right {
text-align: left;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment