The Wayback Machine - https://web.archive.org/web/20220321220256/https://github.com/javascript-tutorial/pt.javascript.info/pull/136
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript Animations #136

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

karlasamantha
Copy link

@karlasamantha karlasamantha commented May 20, 2020

No description provided.

@CLAassistant
Copy link

@CLAassistant CLAassistant commented May 20, 2020

CLA assistant check
All committers have signed the CLA.


An animation can be implemented as a sequence of frames -- usually small changes to HTML/CSS properties.
A animação pode ser implmentada como uma sequência de frames (quadros) -- geralmente pequenas modificações nas propriedades de HTML/CSS.
Copy link
Contributor

@wnleao wnleao May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor typo: implmentada -> implementada


```js
let start = Date.now(); // remember start time
let start = Date.now() // preservar o tempo inicial
Copy link
Contributor

@wnleao wnleao May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont change the code, keep the ';'

let timer = setInterval(function() {
// how much time passed from the start?
let timePassed = Date.now() - start;
let timer = setInterval(function () {
Copy link
Contributor

@wnleao wnleao May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont change the code, keep the same spaces as in the original

let timePassed = Date.now() - start;
let timer = setInterval(function () {
// quanto tempo passou desde o início?
let timePassed = Date.now() - start
Copy link
Contributor

@wnleao wnleao May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, keep the ';'

if (timePassed >= 2000) {
clearInterval(timer); // finish the animation after 2 seconds
return;
if (tempoPetimePassedrcorrido >= 2000) {
Copy link
Contributor

@wnleao wnleao May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also dont translate the variables names

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@wnleao
Copy link
Contributor

@wnleao wnleao commented May 22, 2020

Hi, Karla! Doing fine? Please don't translate or change the source code in the examples. Could you take a look into that? Like, you should keep the ';', spaces and variable names. Cheers!

@karlasamantha
Copy link
Author

@karlasamantha karlasamantha commented May 26, 2020

Hi, Karla! Doing fine? Please don't translate or change the source code in the examples. Could you take a look into that? Like, you should keep the ';', spaces and variable names. Cheers!

Hey, yeah. I'm addressing feedback now. My linter changed the code, fixing that :)

@karlasamantha
Copy link
Author

@karlasamantha karlasamantha commented May 26, 2020

/done

@karlasamantha karlasamantha requested review from wnleao and removed request for May 26, 2020
@odsantos
Copy link
Contributor

@odsantos odsantos commented Dec 8, 2020

Hi @karlasamantha would you please also resolve the conflicts, or kindly inform if unavailable to? Thank you.

@odsantos
Copy link
Contributor

@odsantos odsantos commented May 16, 2021

Hi @karlasamantha , please I wonder if you could resolve the conflicts, or kindly inform if unavailable to? Thank you.

@karlasamantha
Copy link
Author

@karlasamantha karlasamantha commented May 25, 2021

Hi @karlasamantha , please I wonder if you could resolve the conflicts, or kindly inform if unavailable to? Thank you.

Hi @odsantos , sorry for the delay! I'll try to fix the conflicts today!

@karlasamantha
Copy link
Author

@karlasamantha karlasamantha commented May 25, 2021

/done

@karlasamantha
Copy link
Author

@karlasamantha karlasamantha commented May 25, 2021

/done

@odsantos
Copy link
Contributor

@odsantos odsantos commented May 26, 2021

Hi @karlasamantha , thank you.

Copy link
Contributor

@odsantos odsantos left a comment

Hi @karlasamantha ,

The article review is still missing, hopefully to another time.
Please, feel free to leave a note on something you may not agree.

Thank you.


The bottom coordinate of the field is `field.clientHeight`. The CSS `top` property refers to the upper edge of the ball. So it should go from `0` till `field.clientHeight - ball.clientHeight`, that's the final lowest position of the upper edge of the ball.
A coordenada inferior do campo é `field.clientHeight`. Mas a propriedade `top` fornece coordenadas para o topo da bola, a posição da borda é `field.clientHeight - ball.clientHeight`.
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A coordenada inferior do campo é `field.clientHeight`. Mas a propriedade `top` fornece coordenadas para o topo da bola, a posição da borda é `field.clientHeight - ball.clientHeight`.
A coordenada inferior do campo é `field.clientHeight`. Mas a propriedade `top` fornece coordenadas para o topo da bola. Então animamos a propriedade `top` a partir de `0` até `field.clientHeight - ball.clientHeight`, isto é até à posição mais baixa do topo da bola.


To get the "bouncing" effect we can use the timing function `bounce` in `easeOut` mode.
Então animamos a propriedade `top` a partir de `0` até `field.clientHeight - ball.clientHeight`.
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Então animamos a propriedade `top` a partir de `0` até `field.clientHeight - ball.clientHeight`.
Para obter o efeito de "quique", podemos usar a função de tempo `bounce` no modo `easeOut`.


Here's the final code for the animation:
Para obter o efeito de "quique", podemos usar a função de tempo `bounce` no modo `easeOut`
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Para obter o efeito de "quique", podemos usar a função de tempo `bounce` no modo `easeOut`
Aqui está o código final para a animação:


Here's the final code for the animation:
Para obter o efeito de "quique", podemos usar a função de tempo `bounce` no modo `easeOut`

Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Here's the final code for the animation:
Para obter o efeito de "quique", podemos usar a função de tempo `bounce` no modo `easeOut`

Aqui está o código final para a animação:
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Aqui está o código final para a animação:
```js

draw: function(progress) {
ball.style.top = height * progress + 'px'
draw: function (progress) {
ball.style.top = height * progress + "px"
}
});
// animate left (moving to the right)
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// animate left (moving to the right)
// anime a esquerda (movendo para a direita)


[iframe height=250 src="solution"]

Write the animation code. The distance to the left is `100px`.
Escreva o código de animação. A distância para a esquerda é `100px`.
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Escreva o código de animação. A distância para a esquerda é `100px`.
Escreva o código da animação. A distância para a esquerda é `100px`.


Take the solution of the previous task <info:task/animate-ball> as the source.
Use a solução da atividade anterior <info:task/animate-ball> como a fonte.
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use a solução da atividade anterior <info:task/animate-ball> como a fonte.
Use a solução da atividade anterior <info:task/animate-ball> como fonte.

And stood awhile in thought.
<textarea id="textExample" rows="5" cols="60">
Ele pegou sua espada vorpal na mão:
Faz tempo que o manxome inimigo que ele procurava -
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Faz tempo que o manxome inimigo que ele procurava -
Faz tempo que o inimigo manxome ele procurava -

Ele pegou sua espada vorpal na mão:
Faz tempo que o manxome inimigo que ele procurava -
Então ele descansou perto da árvore Tumtum,
E ficou um pouco em pensamento.
</textarea>

<button onclick="animateText(textExample)">Run the animated typing!</button>
Copy link
Contributor

@odsantos odsantos May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<button onclick="animateText(textExample)">Run the animated typing!</button>
<button onclick="animateText(textExample)">Corra o texto animado!</button>

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Copy link
Contributor

@odsantos odsantos left a comment

Hi @karlasamantha ,

Here is the whole review.
Please, feel free to leave a note where you might not agree.

Thank you,
Osvaldo.

7-animation/3-js-animation/article.md Outdated Show resolved Hide resolved

The pseudo-code can look like this:
O pseudo-código pode ficar assim:

```js
let timer = setInterval(function() {
if (animation complete) clearInterval(timer);
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (animation complete) clearInterval(timer);
if (animação completa) clearInterval(timer);


The pseudo-code can look like this:
O pseudo-código pode ficar assim:

```js
let timer = setInterval(function() {
if (animation complete) clearInterval(timer);
else increase style.left by 2px
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else increase style.left by 2px
else incremente style.left em 2px

// as timePassed goes from 0 to 2000
// left gets values from 0px to 400px
// timePassed vai de 0 a 2000
// recebe valores de 0 a 400px
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// recebe valores de 0 a 400px
// 'left' recebe valores de 0 a 400px

draw(timePassed);
}, 20);
// as timePassed goes from 0 to 2000
// left gets values from 0px to 400px
// timePassed vai de 0 a 2000
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// timePassed vai de 0 a 2000
// enquanto timePassed vai de 0 a 2000

- <span style="color:#EE6B47">Red</span> is the regular variant of `circ` (`easeIn`).
- <span style="color:#8DB173">Green</span> -- `easeOut`.
- <span style="color:#EE6B47">Red</span> é a variante regular de `circ` (`easeIn`).
- <span style="color:#8DB173">Greed</span> -- `easeOut`.
- <span style="color:#62C0DC">Blue</span> -- `easeInOut`.
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- <span style="color:#62C0DC">Blue</span> -- `easeInOut`.
- <span style="color:#62C0DC">Azul</span> -- `easeInOut`.


Here's the animated "bouncing" text typing:
Aqui está o texto animato "quicando":
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Aqui está o texto animato "quicando":
Aqui está o texto animado "quicando":


For animations that CSS can't handle well, or those that need tight control, JavaScript can help. JavaScript animations should be implemented via `requestAnimationFrame`. That built-in method allows to setup a callback function to run when the browser will be preparing a repaint. Usually that's very soon, but the exact time depends on the browser.
Para animação que CSS não lida bem, ou aquelas que precisam de controle rígido, JavaScript pode ajudar. Animações JavaScript devem ser implementadas via `requestAnimationFrame`. Esse método embutido permite configurar uma callback para que seja executada quando o navegador estiver preparando uma repintura. Geralmente é bem breve, mas o tempo exato depende do navegador.
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Para animação que CSS não lida bem, ou aquelas que precisam de controle rígido, JavaScript pode ajudar. Animações JavaScript devem ser implementadas via `requestAnimationFrame`. Esse método embutido permite configurar uma callback para que seja executada quando o navegador estiver preparando uma repintura. Geralmente é bem breve, mas o tempo exato depende do navegador.
Para animação que CSS não lida bem, ou aquelas que precisam de controle rígido, JavaScript pode ajudar. Animações com JavaScript devem ser implementadas via `requestAnimationFrame`. Esse método embutido permite configurar uma callback para que seja executada quando o navegador estiver preparando uma repintura. Geralmente é bem breve, mas o tempo exato depende do navegador.

7-animation/3-js-animation/article.md Outdated Show resolved Hide resolved

JavaScript animations can use any timing function. We covered a lot of examples and transformations to make them even more versatile. Unlike CSS, we are not limited to Bezier curves here.
Animações JavaScript podem usar qualquer função de tempo. Cobrimos muitos exemplos e transformações para fazê-las ainda mais versáteis. Ao contrário de CSS, não estamos limitados às curvas de Bezier.
Copy link
Contributor

@odsantos odsantos May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Animações JavaScript podem usar qualquer função de tempo. Cobrimos muitos exemplos e transformações para fazê-las ainda mais versáteis. Ao contrário de CSS, não estamos limitados às curvas de Bezier.
Animações com JavaScript podem usar qualquer função de tempo. Cobrimos muitos exemplos e transformações para fazê-las ainda mais versáteis. Ao contrário de CSS, não estamos limitados às curvas de Bezier.

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

karlasamantha and others added 2 commits May 27, 2021
Co-authored-by: Osvaldo Dias dos Santos <vadodsantos@yahoo.com>
Co-authored-by: Osvaldo Dias dos Santos <vadodsantos@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
HTTPS · web.archive.org
← Home