-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
209 lines (157 loc) · 5.64 KB
/
app.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Affichage bouton burger menu
const btnMenu = document.querySelector('.btn-rond-menu')
const nav = document.querySelector('.nav-gauche');
const allItemNav = document.querySelectorAll('.nav-menu-item');
const ligne = document.querySelector('.cont-ligne');
btnMenu.addEventListener('click', () => {
ligne.classList.toggle('active')
nav.classList.toggle('menu-visible')
})
if(window.matchMedia('(max-width: 1300px)')) {
allItemNav.forEach(item => {
item.addEventListener('click', () => {
nav.classList.toggle('menu-visible')
ligne.classList.toggle('active');
})
})
}
// Animation écriture page Accueil
const txtAnim = document.querySelector('.txt-animation');
let typewriter = new Typewriter(txtAnim, {
loop: false,
deleteSpeed: 20
})
typewriter
.pauseFor(1800)
.changeDelay(20)
.typeString('Moi c\'est <span style="color: midnightblue;"><strong>Fabrice Chapier</strong></span>,')
.pauseFor(1000)
.typeString('<br/><strong>Développeur Full-Stack</strong> !')
.pauseFor(1000)
.deleteChars(13)
.typeString('<span style="color: #27ae60;"> PhP</span> !')
.pauseFor(1000)
.deleteChars(5)
.typeString('<span style="color: #EA39ff;"> WordPress</span> !')
.pauseFor(1000)
.deleteChars(13)
.typeString('<span style="color: midnightblue;"> JavaScript</span> !')
.pauseFor(1000)
.deleteChars(12)
.typeString('<span style="color: #ff6910;"> Front-End </span> !')
.start()
// Animation Contact
const input_fields = document.querySelectorAll('input');
for(let i = 0; i < input_fields.length; i++) {
let field = input_fields[i];
field.addEventListener('input', (e) => {
if(e.target.value !== ''){
e.target.parentNode.classList.add('animation')
} else if (e.target.value == ''){
e.target.parentNode.classList.remove('animation')
}
})
}
// Anim GSAP + ScrollMagic
const navbar = document.querySelector('.nav-gauche');
const titre = document.querySelector('h1');
const btn = document.querySelectorAll('.btn-acc')
const btnMedias = document.querySelectorAll('.media')
const btnRondAccueil = document.querySelector('.btn-rond')
const TL1 = gsap.timeline({paused: true});
TL1
.to(navbar, {left: '0px', ease: Power3.easeOut, duration: 0.6})
.from(titre, {y: -50, opacity: 0, ease: Power3.easeOut, duration: 0.4})
.staggerFrom(btn, 1, {opacity: 0}, 0.2, '-=0.30')
.staggerFrom(btnMedias, 1, {opacity: 0}, 0.2, '-=0.75')
.from(btnRondAccueil, {y: -50, opacity:0, ease: Power3.easeOut, duration: 0.4}, '-=1')
window.addEventListener('load', () => {
TL1.play();
})
// Animation ScrollMagic GSAP presentation
const presentationContainer = document.querySelector('.presentation')
const titrePres = document.querySelector('.titre-pres');
const presGauche = document.querySelector('.pres-gauche')
const listePres = document.querySelectorAll('.item-liste')
const tlpres = new TimelineMax();
tlpres
.from(titrePres, {y: -200, opacity: 0, duration: 0.6})
.from(presGauche, {y:-20, opacity: 0, duration: 0.6}, '-=0.5')
.staggerFrom(listePres, 1, {opacity: 0}, 0.2, '-=0.5')
const controller = new ScrollMagic.Controller();
const scene = new ScrollMagic.Scene({
triggerElement: presentationContainer,
triggerHook: 0.5,
reverse: false
})
.setTween(tlpres)
// .addIndicators()
.addTo(controller)
// Animation portfolio
const portfolioContainer = document.querySelector('.portfolio')
const titrePortfolio = document.querySelector('.titre-port')
const itemPortfolio = document.querySelectorAll('.vague1')
const tlPortfolio = new TimelineMax();
tlPortfolio
.from(titrePortfolio, {y: -50, opacity: 0, duration: 0.5})
.staggerFrom(itemPortfolio, 1, {opacity: 0}, 0.2, '-=0.5')
const scene2 = new ScrollMagic.Scene({
triggerElement: portfolioContainer,
triggerHook: 0.5,
reverse: false
})
.setTween(tlPortfolio)
// .addIndicators()
.addTo(controller)
// Vague 2
const itemPortfolio2 = document.querySelectorAll('.vague2')
const tlPortfolio2 = new TimelineMax();
tlPortfolio2
.staggerFrom(itemPortfolio2, 1, {opacity: 0}, 0.2, '-=0.5')
const scene3 = new ScrollMagic.Scene({
triggerElement: itemPortfolio,
triggerHook: 0.2,
reverse: false
})
.setTween(tlPortfolio2)
// .addIndicators()
.addTo(controller)
// Vague 3
const itemPortfolio3 = document.querySelectorAll('.vague3')
const tlPortfolio3 = new TimelineMax();
tlPortfolio3
.staggerFrom(itemPortfolio3, 1, {opacity: 0}, 0.2, '-=0.5')
const scene4 = new ScrollMagic.Scene({
triggerElement: itemPortfolio2,
triggerHook: 0.2,
reverse: false
})
.setTween(tlPortfolio3)
// .addIndicators()
.addTo(controller)
// Animation soft skills & programmes
const sectionComp = document.querySelector('.section-range');
const titreComp = document.querySelector('.titre-exp');
const sstitreComp = document.querySelector('.sous-titre-exp');
const allLabel = document.querySelectorAll('.label-skill')
const allPourcent = document.querySelectorAll('.number-skill')
const allBarres = document.querySelectorAll('.barre-skill')
const allShadowBarres = document.querySelectorAll('.barre-grises')
const tlCompetences = new TimelineMax();
tlCompetences
.from(titreComp, {opacity: 0, duration: 0.6})
.from(sstitreComp, {opacity: 0, duration: 0.8})
.staggerFrom(allLabel, 0.5, {y: -50, opacity:0}, 0.1, '-=0.5')
.staggerFrom(allPourcent, 0.5, {y: -10, opacity:0}, 0.1, '-=1')
.staggerFrom(allShadowBarres, 0.5, {y: -10, opacity:0}, 0.1, '-=1')
.staggerFrom(allBarres, 0.5, {y: -10, opacity:0}, 0.1, '-=1')
const scene5 = new ScrollMagic.Scene({
triggerElement: sectionComp,
reverse: false
})
.setTween(tlCompetences)
.addTo(controller);
// Tooltips page accueil et menu
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});