Skip to content

JavaScript Animations #136

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes typos
  • Loading branch information
karlasamantha committed May 20, 2020
commit 66086aef0978291009611834f766e846e45c0e0e
2 changes: 1 addition & 1 deletion 7-animation/3-js-animation/2-animate-ball-hops/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A coordenada horizontal é modificada por outra regra: ela não "quica", mas gra

Podemos escrever mais um `animate` para isso.

Como função the temo podemos usar `liner`, mas algo como `makeEaseOut(quad)` parece bem melhor.
Como função de tempo podemos usar `liner`, mas algo como `makeEaseOut(quad)` parece bem melhor.

O código:

Expand Down
17 changes: 6 additions & 11 deletions 7-animation/3-js-animation/text.view/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!DOCTYPE HTML>
<html>

<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<script src="https://js.cx/libs/animate.js"></script>
</head>

Expand All @@ -15,15 +15,13 @@
E ficou um pouco em pensamento.
</textarea>

<button onclick="animateText(textExample)">
Execute a animação escrita!
</button>
<button onclick="animateText(textExample)">Execute a animação em texto!</button>

<script>
function animateText(textArea) {
let text = textArea.value
let to = text.length,
from = 0
from = 0;

animate({
duration: 5000,
Expand All @@ -38,10 +36,7 @@
function bounce(timeFraction) {
for (let a = 0, b = 1, result; 1; a += b, b /= 2) {
if (timeFraction >= (7 - 4 * a) / 11) {
return (
-Math.pow((11 - 6 * a - 11 * timeFraction) / 4, 2) +
Math.pow(b, 2)
)
return (-Math.pow((11 - 6 * a - 11 * timeFraction) / 4, 2) + Math.pow(b, 2))
}
}
}
Expand Down