-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
60 lines (53 loc) · 1.57 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import "./main-estile.css";
import { tween1 } from "./components/tween1";
import {
containerOfButtons,
pauseButton,
playButton,
} from "./components/buttons";
import { tween2 } from "./components/tween2";
import {
creandoElemento1,
creandoElemento2,
creandoElemento3,
} from "./components/gotas";
import { creandoGotas } from "./components/all-tweens";
import { tween3 } from "./components/tween3";
import * as TWEEN from "@tweenjs/tween.js";
// import { splitVendorChunkPlugin } from "vite";
// IMPORTS ENDS
// creando el body para anexar mis gotas al DOM
const body = document.body;
body.className = "bordes1";
body.append(creandoElemento1(), creandoElemento2(), creandoElemento3());
// creando gotas
const gota1 = document.querySelectorAll(".estilo_de_gotas")[0]; // Get the element we want to animate.
const gota2 = document.querySelectorAll(".estilo_de_gotas")[1]; // Get the element we want to animate.
const gota3 = document.querySelectorAll(".estilo_de_gotas")[2]; // Get the element we want to animate.
creandoGotas(gota1, gota2, gota3);
// Setup the animation loop.
let time;
export function animate(time) {
TWEEN.update();
tween1.update(time);
tween2.update(time);
tween3.update(time);
time = requestAnimationFrame(animate);
}
// START ANIMATION IN REQUEST ANIMATION
// requestAnimationFrame(animate);
window.addEventListener("DOMContentLoaded", () => {
animate();
/* ocultando botones para luego
darle un mejor comportamiento */
containerOfButtons(
body,
playButton,
pauseButton,
gota1,
gota2,
gota3,
animate,
time
);
});