chrome style fix + improv animations + hover interactions
This commit is contained in:
parent
d7fa536c82
commit
3e508fd3a9
113
index.html
113
index.html
@ -8,6 +8,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="about"><a href="https://vvvvvvaria.org/logs/narrowcast/" target="_blank">back<span> ↗</span><br>↬ stage </a></div>
|
<div class="about"><a href="https://vvvvvvaria.org/logs/narrowcast/" target="_blank">back<span> ↗</span><br>↬ stage </a></div>
|
||||||
|
|
||||||
<div id="side" class="sidebar sidemin">
|
<div id="side" class="sidebar sidemin">
|
||||||
@ -76,79 +77,75 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<p class="note"> * move and resize the elements above by dragging their corners and sides *</p>
|
<p class="note"> * move and resize the elements above by dragging their corners / sides and click on the page to set the position *</p>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- button to hide side pannel -->
|
||||||
|
|
||||||
<!-- BBUTTON HIDE side pannel -->
|
<script type="text/javascript">
|
||||||
|
|
||||||
<script type="text/javascript">
|
function fside() {
|
||||||
|
var element = document.getElementById("side");
|
||||||
|
element.classList.toggle("sideminclicked");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
function fside() {
|
<!-- drag and resize library: https://interactjs.io/docs/installation#cdn-streamlined -->
|
||||||
var element = document.getElementById("side");
|
<script src="interact.min.js"></script>
|
||||||
element.classList.toggle("sideminclicked");
|
<!-- script above same as <script src="https://cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js"></script> -->
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
<!-- also found this other options:
|
||||||
|
https://www.webcomponents.org/element/jifalops/drag-resize
|
||||||
|
https://codepen.io/zz85/pen/gbOoVP -->
|
||||||
|
|
||||||
<!-- DRAG and RESIZE library -->
|
<script>
|
||||||
|
interact('.resize-drag')
|
||||||
|
.draggable({
|
||||||
|
onmove: window.dragMoveListener
|
||||||
|
})
|
||||||
|
.resizable({
|
||||||
|
preserveAspectRatio: true,
|
||||||
|
edges: { left: true, right: true, bottom: true, top: true }
|
||||||
|
})
|
||||||
|
.on('resizemove', function (event) {
|
||||||
|
var target = event.target,
|
||||||
|
x = (parseFloat(target.getAttribute('data-x')) || 0),
|
||||||
|
y = (parseFloat(target.getAttribute('data-y')) || 0);
|
||||||
|
|
||||||
<!-- source: https://interactjs.io/docs/installation#cdn-streamlined -->
|
// update the element's style
|
||||||
<script src="interact.min.js"></script>
|
target.style.width = event.rect.width + 'px';
|
||||||
<!-- script above same as https://cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js -->
|
target.style.height = event.rect.height + 'px';
|
||||||
|
|
||||||
<!-- also found this other options:
|
// translate when resizing from top or left edges
|
||||||
https://www.webcomponents.org/element/jifalops/drag-resize
|
x += event.deltaRect.left;
|
||||||
https://codepen.io/zz85/pen/gbOoVP -->
|
y += event.deltaRect.top;
|
||||||
|
|
||||||
<script>
|
target.style.webkitTransform = target.style.transform =
|
||||||
interact('.resize-drag')
|
'translate(' + x + 'px,' + y + 'px)';
|
||||||
.draggable({
|
|
||||||
onmove: window.dragMoveListener
|
|
||||||
})
|
|
||||||
.resizable({
|
|
||||||
preserveAspectRatio: true,
|
|
||||||
edges: { left: true, right: true, bottom: true, top: true }
|
|
||||||
})
|
|
||||||
.on('resizemove', function (event) {
|
|
||||||
var target = event.target,
|
|
||||||
x = (parseFloat(target.getAttribute('data-x')) || 0),
|
|
||||||
y = (parseFloat(target.getAttribute('data-y')) || 0);
|
|
||||||
|
|
||||||
// update the element's style
|
target.setAttribute('data-x', x);
|
||||||
target.style.width = event.rect.width + 'px';
|
target.setAttribute('data-y', y);
|
||||||
target.style.height = event.rect.height + 'px';
|
target.textContent = event.rect.width + '×' + event.rect.height;
|
||||||
|
});
|
||||||
|
|
||||||
// translate when resizing from top or left edges
|
function dragMoveListener (event) {
|
||||||
x += event.deltaRect.left;
|
var target = event.target,
|
||||||
y += event.deltaRect.top;
|
// keep the dragged position in the data-x/data-y attributes
|
||||||
|
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
|
||||||
|
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
|
||||||
|
|
||||||
target.style.webkitTransform = target.style.transform =
|
// translate the element
|
||||||
'translate(' + x + 'px,' + y + 'px)';
|
target.style.webkitTransform =
|
||||||
|
target.style.transform =
|
||||||
|
'translate(' + x + 'px, ' + y + 'px)';
|
||||||
|
|
||||||
target.setAttribute('data-x', x);
|
// update the posiion attributes
|
||||||
target.setAttribute('data-y', y);
|
target.setAttribute('data-x', x);
|
||||||
target.textContent = event.rect.width + '×' + event.rect.height;
|
target.setAttribute('data-y', y);
|
||||||
});
|
}
|
||||||
|
</script>
|
||||||
function dragMoveListener (event) {
|
|
||||||
var target = event.target,
|
|
||||||
// keep the dragged position in the data-x/data-y attributes
|
|
||||||
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
|
|
||||||
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
|
|
||||||
|
|
||||||
// translate the element
|
|
||||||
target.style.webkitTransform =
|
|
||||||
target.style.transform =
|
|
||||||
'translate(' + x + 'px, ' + y + 'px)';
|
|
||||||
|
|
||||||
// update the posiion attributes
|
|
||||||
target.setAttribute('data-x', x);
|
|
||||||
target.setAttribute('data-y', y);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -124,7 +124,7 @@ button.minimize{
|
|||||||
.sidetop {
|
.sidetop {
|
||||||
height: 45vh;
|
height: 45vh;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
justify-content: end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidetop p {
|
.sidetop p {
|
||||||
@ -191,12 +191,12 @@ button.minimize{
|
|||||||
|
|
||||||
.resize-drag {
|
.resize-drag {
|
||||||
width: 620px;
|
width: 620px;
|
||||||
padding: 1.4rem 0.4rem 0.4rem 1.4rem;
|
padding: 0.4rem 1.8rem 1.8rem 0.4rem;
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
/* This makes things *much* easier */
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
box-shadow: inset 0.6rem 0.2rem 0.9rem #ffe4fd;
|
box-shadow: inset -0.6rem 0rem 0.8rem #ffe4fd;
|
||||||
|
border-radius: 0.1rem 0.1rem 0.2rem 0.1rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.drag::before, .resize-drag::before, .live > *::before {
|
.drag::before, .resize-drag::before, .live > *::before {
|
||||||
@ -208,11 +208,12 @@ button.minimize{
|
|||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.resize-drag {
|
.resize-drag:hover {
|
||||||
|
box-shadow: 0.2rem 0.2rem 0.6rem #ffe4fd;
|
||||||
animation: corners 8s infinite alternate;
|
animation: corners 8s infinite alternate;
|
||||||
-o-animation: corners 8s infinite alternate;
|
-o-animation: corners 8s infinite alternate;
|
||||||
-moz-animation: corners 8s infinite alternate;
|
-moz-animation: corners 8s infinite alternate;
|
||||||
@ -221,29 +222,31 @@ button.minimize{
|
|||||||
|
|
||||||
@keyframes corners {
|
@keyframes corners {
|
||||||
0% {
|
0% {
|
||||||
border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
border-radius: 0.1rem 0.1rem 0.2rem 0.1rem;
|
||||||
-webkit-border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
-webkit-border-radius: 0.1rem 0.1rem 0.2rem 0.1rem;
|
||||||
}
|
}
|
||||||
70% {
|
20% {
|
||||||
border-radius: 2rem 0rem 1rem 2rem;
|
|
||||||
-webkit-border-radius: 2rem 0rem 1rem 2rem;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
||||||
-webkit-border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem; }
|
|
||||||
@-webkit-keyframes corners {
|
|
||||||
0% {
|
|
||||||
border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
|
||||||
-webkit-border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
|
||||||
}
|
|
||||||
70% {
|
|
||||||
border-radius: 2rem 0rem 1rem 2rem;
|
|
||||||
-webkit-border-radius: 2rem 0rem 1rem 2rem;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
|
||||||
-webkit-border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
-webkit-border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
||||||
}
|
}
|
||||||
|
100% {
|
||||||
|
border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
||||||
|
-webkit-border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-webkit-keyframes corners {
|
||||||
|
0% {
|
||||||
|
border-radius: 2rem 0rem 1rem 2rem;
|
||||||
|
-webkit-border-radius: 2rem 0rem 1rem 2rem;
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
||||||
|
-webkit-border-radius: 0rem 4rem 2rem 1rem / 0rem 1rem 2rem 0rem;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
||||||
|
-webkit-border-radius: 1% 0% 0% 0% / 45% 0% 0% 0%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user