TranslateY animation bugging
up vote
0
down vote
favorite
I have a box that I would like to expand (100% height) after click, and then collapse and stick to bottom. I made a function (vue framework structure) to run the animation, but unfortunately it keeps on bugging.. how do I make it more smooth and less buggy? Demo: Fiddle.
JS:
animate()
let height_ = window.innerHeight - this.$refs.box.getBoundingClientRect().top
if(!this.revealed)
event.target.style.maxHeight = '100%';
event.target.style.transform = 'translateY(0px)'
this.revealed = true
else if(this.revealed)
console.log(height_)
event.target.style.maxHeight = height_ - 570 + 'px'
event.target.style.transform = 'translateY(570px)'
this.revealed = false
CSS:
.grid
width: 100vw;
height: 100vh;
display: grid;
grid-template-rows: 30% 32% 16% 22%;
grid-template-columns: 47% 29% 24%;
.section__extra
grid-area: 1 / 3 / 5 / 2;
background-color: black;
position: relative;
z-index: 1000;
left: -2vw;
transform: translateY(570px);
display: flex;
flex-flow: column;
-webkit-transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
javascript css vue.js
|
show 4 more comments
up vote
0
down vote
favorite
I have a box that I would like to expand (100% height) after click, and then collapse and stick to bottom. I made a function (vue framework structure) to run the animation, but unfortunately it keeps on bugging.. how do I make it more smooth and less buggy? Demo: Fiddle.
JS:
animate()
let height_ = window.innerHeight - this.$refs.box.getBoundingClientRect().top
if(!this.revealed)
event.target.style.maxHeight = '100%';
event.target.style.transform = 'translateY(0px)'
this.revealed = true
else if(this.revealed)
console.log(height_)
event.target.style.maxHeight = height_ - 570 + 'px'
event.target.style.transform = 'translateY(570px)'
this.revealed = false
CSS:
.grid
width: 100vw;
height: 100vh;
display: grid;
grid-template-rows: 30% 32% 16% 22%;
grid-template-columns: 47% 29% 24%;
.section__extra
grid-area: 1 / 3 / 5 / 2;
background-color: black;
position: relative;
z-index: 1000;
left: -2vw;
transform: translateY(570px);
display: flex;
flex-flow: column;
-webkit-transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
javascript css vue.js
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
Then how do I slide up from the bottom? Should I changetransform-origin Y
?
– kabugh
Nov 11 at 20:26
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
But the height of a box is set to specific value and then afterclick
I need it to be 100% vh, usingtranslateY
allows only to move the box.
– kabugh
Nov 11 at 20:33
|
show 4 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a box that I would like to expand (100% height) after click, and then collapse and stick to bottom. I made a function (vue framework structure) to run the animation, but unfortunately it keeps on bugging.. how do I make it more smooth and less buggy? Demo: Fiddle.
JS:
animate()
let height_ = window.innerHeight - this.$refs.box.getBoundingClientRect().top
if(!this.revealed)
event.target.style.maxHeight = '100%';
event.target.style.transform = 'translateY(0px)'
this.revealed = true
else if(this.revealed)
console.log(height_)
event.target.style.maxHeight = height_ - 570 + 'px'
event.target.style.transform = 'translateY(570px)'
this.revealed = false
CSS:
.grid
width: 100vw;
height: 100vh;
display: grid;
grid-template-rows: 30% 32% 16% 22%;
grid-template-columns: 47% 29% 24%;
.section__extra
grid-area: 1 / 3 / 5 / 2;
background-color: black;
position: relative;
z-index: 1000;
left: -2vw;
transform: translateY(570px);
display: flex;
flex-flow: column;
-webkit-transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
javascript css vue.js
I have a box that I would like to expand (100% height) after click, and then collapse and stick to bottom. I made a function (vue framework structure) to run the animation, but unfortunately it keeps on bugging.. how do I make it more smooth and less buggy? Demo: Fiddle.
JS:
animate()
let height_ = window.innerHeight - this.$refs.box.getBoundingClientRect().top
if(!this.revealed)
event.target.style.maxHeight = '100%';
event.target.style.transform = 'translateY(0px)'
this.revealed = true
else if(this.revealed)
console.log(height_)
event.target.style.maxHeight = height_ - 570 + 'px'
event.target.style.transform = 'translateY(570px)'
this.revealed = false
CSS:
.grid
width: 100vw;
height: 100vh;
display: grid;
grid-template-rows: 30% 32% 16% 22%;
grid-template-columns: 47% 29% 24%;
.section__extra
grid-area: 1 / 3 / 5 / 2;
background-color: black;
position: relative;
z-index: 1000;
left: -2vw;
transform: translateY(570px);
display: flex;
flex-flow: column;
-webkit-transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
transition: all 1.3s cubic-bezier(0.86, 0, 0.07, 1);
javascript css vue.js
javascript css vue.js
asked Nov 11 at 19:46
kabugh
1199
1199
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
Then how do I slide up from the bottom? Should I changetransform-origin Y
?
– kabugh
Nov 11 at 20:26
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
But the height of a box is set to specific value and then afterclick
I need it to be 100% vh, usingtranslateY
allows only to move the box.
– kabugh
Nov 11 at 20:33
|
show 4 more comments
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
Then how do I slide up from the bottom? Should I changetransform-origin Y
?
– kabugh
Nov 11 at 20:26
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
But the height of a box is set to specific value and then afterclick
I need it to be 100% vh, usingtranslateY
allows only to move the box.
– kabugh
Nov 11 at 20:33
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
Then how do I slide up from the bottom? Should I change
transform-origin Y
?– kabugh
Nov 11 at 20:26
Then how do I slide up from the bottom? Should I change
transform-origin Y
?– kabugh
Nov 11 at 20:26
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
But the height of a box is set to specific value and then after
click
I need it to be 100% vh, using translateY
allows only to move the box.– kabugh
Nov 11 at 20:33
But the height of a box is set to specific value and then after
click
I need it to be 100% vh, using translateY
allows only to move the box.– kabugh
Nov 11 at 20:33
|
show 4 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
The solution to this issue was to not animate 2 radical different properties with a none linear curve.
The solution ended up with always having the box at 100vh, hide the overflow, and only animate the transform. (Which also is better for the performance).
See the comment thread for more information.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252537%2ftranslatey-animation-bugging%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The solution to this issue was to not animate 2 radical different properties with a none linear curve.
The solution ended up with always having the box at 100vh, hide the overflow, and only animate the transform. (Which also is better for the performance).
See the comment thread for more information.
add a comment |
up vote
1
down vote
accepted
The solution to this issue was to not animate 2 radical different properties with a none linear curve.
The solution ended up with always having the box at 100vh, hide the overflow, and only animate the transform. (Which also is better for the performance).
See the comment thread for more information.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The solution to this issue was to not animate 2 radical different properties with a none linear curve.
The solution ended up with always having the box at 100vh, hide the overflow, and only animate the transform. (Which also is better for the performance).
See the comment thread for more information.
The solution to this issue was to not animate 2 radical different properties with a none linear curve.
The solution ended up with always having the box at 100vh, hide the overflow, and only animate the transform. (Which also is better for the performance).
See the comment thread for more information.
answered Nov 11 at 21:03
Benjaco
43439
43439
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252537%2ftranslatey-animation-bugging%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It's kinda "2 uneven bezier curve" there don't cancel each outer out. You have to options, take a look on transform-origin and let it expand from the bottom that way, or you could go the javascript route and cancel the animation out perfectly, take a look at youtube.com/watch?v=YdvQPkJd0gc if you want to go the javascript route.
– Benjaco
Nov 11 at 20:12
or, why not slide it up from the bottom
– Benjaco
Nov 11 at 20:15
Then how do I slide up from the bottom? Should I change
transform-origin Y
?– kabugh
Nov 11 at 20:26
I would not touch the max height property, just let it overflow the screen and animate translateY as you are doing
– Benjaco
Nov 11 at 20:31
But the height of a box is set to specific value and then after
click
I need it to be 100% vh, usingtranslateY
allows only to move the box.– kabugh
Nov 11 at 20:33