inscription ok
This commit is contained in:
@@ -12,7 +12,7 @@ function init_variable_analyse(){
|
||||
|
||||
// Analayse des choix avec les checkboxs
|
||||
keywords = ["1. De face", "2. De profil", "3. Debout", "4. Eyes contact", "5. toto"]
|
||||
nb_analyse_demande = 3
|
||||
nb_analyse_demande = 1//3
|
||||
|
||||
w_valider = w_bouton*1.2
|
||||
h_valider = h_bouton*1.2
|
||||
|
||||
@@ -31,55 +31,6 @@ function init_variable_fonction(dict_boutons, dict_imgs ){
|
||||
}
|
||||
|
||||
|
||||
function new_image(src) {
|
||||
img = new Image()
|
||||
img.src = src
|
||||
return img
|
||||
}
|
||||
|
||||
function getMousePos(c, event) {
|
||||
var rect = c.getBoundingClientRect()
|
||||
return {
|
||||
x: event.clientX - rect.left,
|
||||
y: event.clientY - rect.top
|
||||
}
|
||||
}
|
||||
|
||||
function is_inside(xyMove, x, y, w, h) {
|
||||
return (xyMove.x > x && xyMove.x < x+w && xyMove.y > y && xyMove.y < y +h)
|
||||
}
|
||||
|
||||
function click_inside(xyClick, x, y, w, h) {
|
||||
return (xyClick.x > x && xyClick.x < x+w && xyClick.y > y && xyClick.y < y +h)
|
||||
}
|
||||
|
||||
function draw_rectangle(originex, originey, largeur, hauteur, couleur, alpha){
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(originex, originey)
|
||||
ctx.lineTo(originex+largeur, originey)
|
||||
ctx.lineTo(originex+largeur, originey+hauteur)
|
||||
ctx.lineTo(originex, originey+hauteur)
|
||||
ctx.lineTo(originex, originey)
|
||||
ctx.fillStyle = couleur
|
||||
ctx.globalAlpha = alpha
|
||||
ctx.fill()
|
||||
ctx.globalAlpha = 1
|
||||
}
|
||||
|
||||
function draw_contour(originex, originey, largeur, hauteur, couleur, alpha=1){
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(originex, originey)
|
||||
ctx.lineTo(originex+largeur, originey)
|
||||
ctx.lineTo(originex+largeur, originey+hauteur)
|
||||
ctx.lineTo(originex, originey+hauteur)
|
||||
ctx.lineTo(originex, originey)
|
||||
ctx.lineWidth = 5
|
||||
ctx.strokeStyle = couleur
|
||||
ctx.globalAlpha = alpha
|
||||
ctx.stroke()
|
||||
ctx.lineWidth = 1
|
||||
}
|
||||
|
||||
function bloquer_pose(L_poses){
|
||||
for (p=0; p<L_poses.length; p++){
|
||||
idx_i_p = L_poses[p][3]
|
||||
@@ -91,20 +42,6 @@ function bloquer_pose(L_poses){
|
||||
}
|
||||
}
|
||||
|
||||
function progress_bar(N_tache, N_mesh){
|
||||
if (N_tache<=N_mesh){
|
||||
// background
|
||||
draw_rectangle(x_progress_bar, y_progress_bar, w_progress_bar, h_progress_bar, "rgb(255,255,255)", 1)
|
||||
// bar
|
||||
w_bar = ((N_tache-1)/N_mesh)*w_progress_bar
|
||||
draw_rectangle(x_progress_bar, y_progress_bar, w_bar, h_progress_bar, "rgb(17, 138, 178)", 1)
|
||||
// // numero de tache
|
||||
// ctx.strokeStyle = "rgb(255, 255, 255)" // Pour que le contour soit rouge
|
||||
// ctx.fillStyle = "rgb(255, 255, 255)" // Pour que l'intérieur soit bleu
|
||||
// ctx.font = "18pt Courier";
|
||||
// ctx.fillText((N_tache)+"/"+(N_mesh), x_progress_bar+w_progress_bar+10, h_progress_bar)
|
||||
}
|
||||
}
|
||||
|
||||
function pose_deja_choisie(L_poses, i_choix, j_choix){
|
||||
deja_choisie = false
|
||||
@@ -118,71 +55,6 @@ function pose_deja_choisie(L_poses, i_choix, j_choix){
|
||||
}
|
||||
}
|
||||
|
||||
function print_text(dialogue) {
|
||||
|
||||
s = dialogue.texte
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
if (s[i].lettre !== undefined) {
|
||||
ctx.strokeStyle = s[i].stroke
|
||||
ctx.fillStyle = s[i].fill
|
||||
ctx.strokeText(s[i].lettre, s[i].x, s[i].y)
|
||||
ctx.fillText(s[i].lettre, s[i].x, s[i].y)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function handle_text(dialogue, x_start, y_start, font, l_max, color="#FFFFFF") {
|
||||
let s = dialogue
|
||||
|
||||
let x = 0
|
||||
let y = y_start
|
||||
|
||||
let mot = ""
|
||||
let img_to_print = ""
|
||||
let lettres = s.split("")
|
||||
let message = []
|
||||
|
||||
let current_fill = color
|
||||
|
||||
ctx.textAlign = "left"
|
||||
ctx.font = font
|
||||
|
||||
while (lettres.length > 0) {
|
||||
l = lettres.splice(0, 1)[0]
|
||||
if (l === " ") {
|
||||
if (x >= l_max) {
|
||||
|
||||
x = 0
|
||||
y += 40
|
||||
for (let i = 0; i < mot.length; i++) {
|
||||
message[message.length-mot.length+i].x = x_start+x
|
||||
message[message.length-mot.length+i].y = y
|
||||
x += ctx.measureText(message[message.length-mot.length+i].lettre).width
|
||||
}
|
||||
}
|
||||
message.push({"lettre": " ", "x": x_start+x, "y": y, "fill": current_fill, "stroke": current_fill})
|
||||
x += ctx.measureText(" ").width
|
||||
mot = ""
|
||||
} else {
|
||||
mot += l
|
||||
message.push({"lettre": l, "x": x_start+x, "y": y, "fill": current_fill, "stroke": current_fill})
|
||||
x += ctx.measureText(l).width
|
||||
}
|
||||
}
|
||||
|
||||
if (x >= l_max) {
|
||||
x = 0
|
||||
y += 40
|
||||
for (let i = 0; i < mot.length; i++) {
|
||||
message[message.length-mot.length+i].x = x_start+x
|
||||
message[message.length-mot.length+i].y = y
|
||||
x += ctx.measureText(message[message.length-mot.length+i].lettre).width
|
||||
}
|
||||
}
|
||||
|
||||
return {"texte": message}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
function affichage_texte_fin(M_fin, E_termine){
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)"
|
||||
ctx.fillStyle = "rgb(255, 255, 255)"
|
||||
//Message de remerciement
|
||||
texte = "Done, thx you :)"
|
||||
font = "100pt Courier"
|
||||
ctx.font = font
|
||||
largeur = ctx.measureText(texte).width
|
||||
print_text(handle_text(texte, (window.innerWidth/2)-(largeur/2), 150, font, window.innerWidth, 1000, color="#FFFFFF"))
|
||||
|
||||
// Texte WAIT
|
||||
texte = "Please a moment"
|
||||
font = "70pt Courier"
|
||||
ctx.font = font
|
||||
largeur = ctx.measureText(texte).width
|
||||
print_text(handle_text(texte, (window.innerWidth/2)-(largeur/2), 350, font, window.innerWidth, 1000, color="#FFFFFF"))
|
||||
|
||||
ctx.strokeStyle = "rgb(239, 71, 111)"
|
||||
ctx.fillStyle = "rgb(239, 71, 111)"
|
||||
texte = " WAIT "
|
||||
largeur = ctx.measureText(texte).width
|
||||
print_text(handle_text(texte, (window.innerWidth/2)-(largeur/2), 350, font, window.innerWidth, 1000))
|
||||
|
||||
// Texte d'envoie
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)"
|
||||
ctx.fillStyle = "rgb(255, 255, 255)"
|
||||
if (!E_termine){
|
||||
print_text(handle_text(M_fin, (window.innerWidth/2)-450, innerHeight/2 +100, "26pt Courier", 1000))
|
||||
}
|
||||
else {
|
||||
print_text(handle_text(M_fin, (window.innerWidth/2)-450, innerHeight/2 +200, "26pt Courier", 1000))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
scale_bouton_commencer = 0.6
|
||||
|
||||
function affichage_inscription(){
|
||||
// Texte
|
||||
draw_rectangle(0,0,canvas.width, canvas.height, "rgb(3, 26, 33)", 1) // ou + clair 4, 38, 48
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)" // Pour que le contour soit rouge
|
||||
ctx.fillStyle = "rgb(255, 255, 255)" // Pour que l'intérieur soit bleu
|
||||
texte = "Are you ready ??????"
|
||||
font = "58pt Courier"
|
||||
ctx.font = font
|
||||
largeur = ctx.measureText(texte).width
|
||||
ctx.fillText(texte, (window.innerWidth/2)- (largeur/2), 100)
|
||||
|
||||
// Pour les zones de textes
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)"
|
||||
ctx.fillStyle = "rgb(255, 255, 255)"
|
||||
ctx.font = "28pt Courier"
|
||||
ctx.fillText("Firstname:", x_texte_zone, parseInt(document.getElementById("Firstname").style.top) -10)
|
||||
ctx.fillText("Name:", x_texte_zone, parseInt(document.getElementById("Name").style.top) - 10)
|
||||
ctx.fillText("Age:", x_texte_zone, parseInt(document.getElementById("Age").style.top) - 10)
|
||||
ctx.fillText("Sexe:", parseInt(document.getElementById("SexeM").style.left), parseInt(document.getElementById("SexeM").style.top) - 10)
|
||||
ctx.fillText("Sexe:", parseInt(document.getElementById("SexeM").style.left), parseInt(document.getElementById("SexeM").style.top) - 10)
|
||||
ctx.font = "24pt Courier"
|
||||
ctx.fillText("Male", parseInt(document.getElementById("SexeM").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+34)
|
||||
ctx.fillText("Female", parseInt(document.getElementById("SexeF").style.left)+40, parseInt(document.getElementById("SexeM").style.top)+34)
|
||||
}
|
||||
|
||||
|
||||
function afficher_bouton_commencer(){
|
||||
w_bouton_commencer = scale_bouton_commencer*boutons["commencer"].width
|
||||
h_bouton_commencer = scale_bouton_commencer*boutons["commencer"].height
|
||||
x_bouton_commencer = (window.innerWidth/2)-(w_bouton_commencer/2)
|
||||
y_bouton_commencer = innerHeight*0.75
|
||||
// Bouton commencer
|
||||
ctx.drawImage(boutons["commencer"], x_bouton_commencer, y_bouton_commencer , w_bouton_commencer, h_bouton_commencer)
|
||||
|
||||
// Survol
|
||||
if(xyMouseMove.x >= x_bouton_commencer && xyMouseMove.x <= x_bouton_commencer + w_bouton_commencer && xyMouseMove.y > y_bouton_commencer && xyMouseMove.y < y_bouton_commencer + h_bouton_commencer){
|
||||
draw_rectangle(x_bouton_commencer, y_bouton_commencer , w_bouton_commencer, h_bouton_commencer, "rgb(200, 200, 200)", 0.6)
|
||||
}
|
||||
}
|
||||
|
||||
function action_bouton_commencer(s){
|
||||
page_inscription = false
|
||||
page_vues = true
|
||||
interactions.push({"time": new Date().getTime(), "type": "bouton commencer"+s})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function traitement_inscription(){
|
||||
affichage_inscription()
|
||||
if (champs_remplis_correctment()){
|
||||
afficher_bouton_commencer()
|
||||
if (clicked && click_inside(xyMouseDown, x_bouton_commencer, y_bouton_commencer , w_bouton_commencer, h_bouton_commencer)){
|
||||
// on passe aux choix
|
||||
action_bouton_commencer("titi")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// CHAMPS INSCRIPTION
|
||||
|
||||
function champs_remplis_correctment(){
|
||||
firstname_ok = false
|
||||
name_ok = false
|
||||
age_ok = false
|
||||
sexe_ok = false
|
||||
if (document.getElementById("Firstname").value.length >0){firstname_ok = true}
|
||||
if (document.getElementById("Name").value.length >0){name_ok = true}
|
||||
if (document.getElementById("Age").value.length >0){age_ok = true}
|
||||
if (document.getElementById("SexeM").checked || document.getElementById("SexeF").checked){ sexe_ok= true}
|
||||
return firstname_ok && name_ok && age_ok && sexe_ok
|
||||
}
|
||||
|
||||
function afficher_champs_inscription() {
|
||||
w_text_zone = 30
|
||||
h_text_zone = 42
|
||||
nb_caract_min = 1
|
||||
nb_caract_max = 30
|
||||
x_texte_zone = (window.innerWidth/3)
|
||||
y_texte_zone = 200
|
||||
ecart_texte_zone = 160
|
||||
|
||||
// Zone de texte : Firstname
|
||||
var input = document.createElement('input');
|
||||
input.type = 'text';
|
||||
input.id = 'Firstname';
|
||||
input.minLength = nb_caract_min
|
||||
input.maxLength = nb_caract_max
|
||||
input.size = w_text_zone
|
||||
input.style.position = 'fixed';
|
||||
input.style.left = x_texte_zone+'px';
|
||||
input.style.top = y_texte_zone+'px';
|
||||
input.style.textAlign = 'left'
|
||||
input.style.height = h_text_zone
|
||||
input.style.font = "24pt Courier"
|
||||
document.body.appendChild(input);
|
||||
input.focus();
|
||||
|
||||
// Zone de texte : Name
|
||||
var input2 = document.createElement('input');
|
||||
input2.type = 'text';
|
||||
input2.id = 'Name';
|
||||
input2.minLength = nb_caract_min
|
||||
input2.maxLength = nb_caract_max
|
||||
input2.size = w_text_zone
|
||||
// style
|
||||
input2.style.position = 'fixed';
|
||||
input2.style.left = x_texte_zone+'px';
|
||||
input2.style.top = ecart_texte_zone+y_texte_zone+'px';
|
||||
input2.style.textAlign = 'left'
|
||||
input2.style.height = h_text_zone
|
||||
input2.style.font = "24pt Courier"
|
||||
document.body.appendChild(input2);
|
||||
input2.focus();
|
||||
|
||||
// Zone de texte : Age
|
||||
var input3 = document.createElement('input');
|
||||
input3.type = 'number';
|
||||
input3.id = 'Age';
|
||||
input3.min = 1
|
||||
input3.max = 99
|
||||
input3.size = w_text_zone
|
||||
// style
|
||||
input3.style.position = 'fixed';
|
||||
input3.style.left = x_texte_zone+'px';
|
||||
input3.style.top = 2*ecart_texte_zone + y_texte_zone+'px';
|
||||
input3.style.textAlign = 'left'
|
||||
input3.style.height = h_text_zone
|
||||
input3.style.font = "24pt Courier"
|
||||
document.body.appendChild(input3);
|
||||
input3.focus();
|
||||
|
||||
// Zone de texte : Sexe
|
||||
var input4 = document.createElement('input');
|
||||
input4.type = 'radio';
|
||||
input4.id = 'SexeM';
|
||||
input4.name = "sexe"
|
||||
//input4.size = w_text_zone
|
||||
// style
|
||||
input4.style.position = 'fixed';
|
||||
input4.style.left = x_texte_zone + 250;
|
||||
input4.style.top = 2*ecart_texte_zone + y_texte_zone+'px';
|
||||
input4.style.height = h_text_zone
|
||||
document.body.appendChild(input4);
|
||||
input4.focus();
|
||||
|
||||
var input5 = document.createElement('input');
|
||||
input5.type = 'radio';
|
||||
input5.id = 'SexeF';
|
||||
input5.name = "sexe"
|
||||
//input4.size = w_text_zone
|
||||
// style
|
||||
input5.style.position = 'fixed';
|
||||
input5.style.left = x_texte_zone + 400;
|
||||
input5.style.top = 2*ecart_texte_zone + y_texte_zone+'px';
|
||||
input5.style.height = h_text_zone
|
||||
document.body.appendChild(input5);
|
||||
input5.focus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function gestion_donnees_personnelles(){
|
||||
// Sauvegarde des infos
|
||||
if (document.getElementById("SexeM").checked){sexe = "M"}
|
||||
else if (document.getElementById("SexeF").checked){sexe = "F"}
|
||||
else {sexe='None'}
|
||||
choix['identite'] = {"Firstname":document.getElementById("Firstname").value,
|
||||
"Name": document.getElementById("Name").value,
|
||||
"Age": document.getElementById("Age").value,
|
||||
"Sexe": sexe}
|
||||
document.getElementById("Firstname").style.display = 'none'
|
||||
document.getElementById("Name").style.display = 'none'
|
||||
document.getElementById("Age").style.display = 'none'
|
||||
document.getElementById("SexeM").style.display = 'none'
|
||||
document.getElementById("SexeF").style.display = 'none'
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
scale_bouton_commencer = 0.6
|
||||
|
||||
function affichage_tuto(){
|
||||
w_bouton_commencer = scale_bouton_commencer*boutons["commencer"].width
|
||||
h_bouton_commencer = scale_bouton_commencer*boutons["commencer"].height
|
||||
// Texte
|
||||
draw_rectangle(0,0,canvas.width, canvas.height, "rgb(3, 26, 33)", 1) // ou + clair 4, 38, 48
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)" // Pour que le contour soit rouge
|
||||
ctx.fillStyle = "rgb(255, 255, 255)" // Pour que l'intérieur soit bleu
|
||||
ctx.font = "bold 58pt Courier";
|
||||
ctx.fillText("Are you ready ??????", (window.innerWidth/2)-450, innerHeight/2 -100)
|
||||
|
||||
// Bouton commencer
|
||||
ctx.drawImage(boutons["commencer"], (window.innerWidth/2)-(w_bouton_commencer/2), innerHeight/2, w_bouton_commencer, h_bouton_commencer)
|
||||
}
|
||||
|
||||
function survol_commencer(){
|
||||
if(xyMouseMove.x >= (window.innerWidth/2)-(w_bouton_commencer/2) && xyMouseMove.x <= (window.innerWidth/2)-(w_bouton_commencer/2) + w_bouton_commencer && xyMouseMove.y > innerHeight/2 && xyMouseMove.y < innerHeight/2 + h_bouton_commencer){
|
||||
draw_rectangle((window.innerWidth/2)-(w_bouton_commencer/2), innerHeight/2, w_bouton_commencer, h_bouton_commencer, "rgb(200, 200, 200)", 0.6)
|
||||
}
|
||||
}
|
||||
|
||||
function action_bouton_commencer(s){
|
||||
page_tuto = false
|
||||
page_vues = true
|
||||
interactions.push({"time": new Date().getTime(), "type": "bouton commencer"+s})
|
||||
}
|
||||
|
||||
|
||||
function traitement_tuto(){
|
||||
affichage_tuto()
|
||||
survol_commencer()
|
||||
if (clicked && click_inside(xyMouseDown, (window.innerWidth/2)-(w_bouton_commencer/2), innerHeight/2, w_bouton_commencer, h_bouton_commencer)){
|
||||
// on passe aux choix
|
||||
action_bouton_commencer("titi")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
function new_image(src) {
|
||||
img = new Image()
|
||||
img.src = src
|
||||
return img
|
||||
}
|
||||
|
||||
function getMousePos(c, event) {
|
||||
var rect = c.getBoundingClientRect()
|
||||
return {
|
||||
x: event.clientX - rect.left,
|
||||
y: event.clientY - rect.top
|
||||
}
|
||||
}
|
||||
|
||||
function is_inside(xyMove, x, y, w, h) {
|
||||
return (xyMove.x > x && xyMove.x < x+w && xyMove.y > y && xyMove.y < y +h)
|
||||
}
|
||||
|
||||
function click_inside(xyClick, x, y, w, h) {
|
||||
return (xyClick.x > x && xyClick.x < x+w && xyClick.y > y && xyClick.y < y +h)
|
||||
}
|
||||
|
||||
function draw_rectangle(originex, originey, largeur, hauteur, couleur, alpha){
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(originex, originey)
|
||||
ctx.lineTo(originex+largeur, originey)
|
||||
ctx.lineTo(originex+largeur, originey+hauteur)
|
||||
ctx.lineTo(originex, originey+hauteur)
|
||||
ctx.lineTo(originex, originey)
|
||||
ctx.fillStyle = couleur
|
||||
ctx.globalAlpha = alpha
|
||||
ctx.fill()
|
||||
ctx.globalAlpha = 1
|
||||
}
|
||||
|
||||
function draw_contour(originex, originey, largeur, hauteur, couleur, alpha=1){
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(originex, originey)
|
||||
ctx.lineTo(originex+largeur, originey)
|
||||
ctx.lineTo(originex+largeur, originey+hauteur)
|
||||
ctx.lineTo(originex, originey+hauteur)
|
||||
ctx.lineTo(originex, originey)
|
||||
ctx.lineWidth = 5
|
||||
ctx.strokeStyle = couleur
|
||||
ctx.globalAlpha = alpha
|
||||
ctx.stroke()
|
||||
ctx.lineWidth = 1
|
||||
}
|
||||
|
||||
function print_text(dialogue) {
|
||||
|
||||
s = dialogue.texte
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
if (s[i].lettre !== undefined) {
|
||||
ctx.strokeStyle = s[i].stroke
|
||||
ctx.fillStyle = s[i].fill
|
||||
ctx.strokeText(s[i].lettre, s[i].x, s[i].y)
|
||||
ctx.fillText(s[i].lettre, s[i].x, s[i].y)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function handle_text(dialogue, x_start, y_start, font, l_max, color="#FFFFFF") {
|
||||
let s = dialogue
|
||||
|
||||
let x = 0
|
||||
let y = y_start
|
||||
|
||||
let mot = ""
|
||||
let img_to_print = ""
|
||||
let lettres = s.split("")
|
||||
let message = []
|
||||
|
||||
let current_fill = color
|
||||
|
||||
ctx.textAlign = "left"
|
||||
ctx.font = font
|
||||
|
||||
while (lettres.length > 0) {
|
||||
l = lettres.splice(0, 1)[0]
|
||||
if (l === " ") {
|
||||
if (x >= l_max) {
|
||||
|
||||
x = 0
|
||||
y += 40
|
||||
for (let i = 0; i < mot.length; i++) {
|
||||
message[message.length-mot.length+i].x = x_start+x
|
||||
message[message.length-mot.length+i].y = y
|
||||
x += ctx.measureText(message[message.length-mot.length+i].lettre).width
|
||||
}
|
||||
}
|
||||
message.push({"lettre": " ", "x": x_start+x, "y": y, "fill": current_fill, "stroke": current_fill})
|
||||
x += ctx.measureText(" ").width
|
||||
mot = ""
|
||||
} else {
|
||||
mot += l
|
||||
message.push({"lettre": l, "x": x_start+x, "y": y, "fill": current_fill, "stroke": current_fill})
|
||||
x += ctx.measureText(l).width
|
||||
}
|
||||
}
|
||||
|
||||
if (x >= l_max) {
|
||||
x = 0
|
||||
y += 40
|
||||
for (let i = 0; i < mot.length; i++) {
|
||||
message[message.length-mot.length+i].x = x_start+x
|
||||
message[message.length-mot.length+i].y = y
|
||||
x += ctx.measureText(message[message.length-mot.length+i].lettre).width
|
||||
}
|
||||
}
|
||||
|
||||
return {"texte": message}
|
||||
}
|
||||
|
||||
|
||||
function progress_bar(N_tache, N_mesh){
|
||||
if (N_tache<=N_mesh){
|
||||
// background
|
||||
draw_rectangle(x_progress_bar, y_progress_bar, w_progress_bar, h_progress_bar, "rgb(255,255,255)", 1)
|
||||
// bar
|
||||
w_bar = ((N_tache-1)/N_mesh)*w_progress_bar
|
||||
draw_rectangle(x_progress_bar, y_progress_bar, w_bar, h_progress_bar, "rgb(17, 138, 178)", 1)
|
||||
// // numero de tache
|
||||
// ctx.strokeStyle = "rgb(255, 255, 255)" // Pour que le contour soit rouge
|
||||
// ctx.fillStyle = "rgb(255, 255, 255)" // Pour que l'intérieur soit bleu
|
||||
// ctx.font = "18pt Courier";
|
||||
// ctx.fillText((N_tache)+"/"+(N_mesh), x_progress_bar+w_progress_bar+10, h_progress_bar)
|
||||
}
|
||||
}
|
||||
+48
-27
@@ -4,7 +4,13 @@
|
||||
// initialisation des variables
|
||||
init_variable(true)
|
||||
// initialisation du canvas : load des images
|
||||
setUp_3D(indice_mesh)
|
||||
//setUp_3D(indice_mesh)
|
||||
|
||||
canvas = document.getElementById("canvas")
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
ctx = canvas.getContext("2d")
|
||||
|
||||
init_data()
|
||||
//init_clavier()
|
||||
// action
|
||||
@@ -42,7 +48,7 @@ function init_variable(premier_appel){
|
||||
indice_mesh = 0 // indice du premier mesh à visionner
|
||||
mesh_courant = "nope" // nom des mesh
|
||||
// nombre de mesh a visionner AU TOTAL
|
||||
nb_mesh = 3
|
||||
nb_mesh = 2 //3
|
||||
|
||||
// Choix des N poses demandé pour les mesh courant
|
||||
choix_courant = {}
|
||||
@@ -74,7 +80,7 @@ function init_variable(premier_appel){
|
||||
R = 2.5
|
||||
|
||||
// Enchainement des pages
|
||||
page_tuto = true // true
|
||||
page_inscription = true // true
|
||||
page_vues = false // false
|
||||
page_analyse = false
|
||||
|
||||
@@ -83,10 +89,14 @@ function init_variable(premier_appel){
|
||||
all_canvasMins = {}
|
||||
|
||||
// pour initialiser les claviers à chaque page
|
||||
premier_tour_page_tuto = true
|
||||
premier_tour_page_inscription = true
|
||||
premier_tour_page_vues = true
|
||||
premier_tour_page_analyse = true
|
||||
|
||||
// message de fin
|
||||
message_fin = "> Sending data in progress ..."
|
||||
envoie_termine = false
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
@@ -213,15 +223,17 @@ function setUp_3D(idx_mesh){
|
||||
////////////////////////////////////////
|
||||
// CLAVIER
|
||||
|
||||
function action_clavier_tuto(event){
|
||||
function action_clavier_inscription(event){
|
||||
switch (event.key){
|
||||
// selectionner pose
|
||||
case ' ' :
|
||||
action_bouton_commencer('clavier')
|
||||
if (champs_remplis_correctment()){
|
||||
action_bouton_commencer('clavier')}
|
||||
break;
|
||||
// valider
|
||||
case 'Enter':
|
||||
action_bouton_commencer('clavier')
|
||||
if (champs_remplis_correctment()){
|
||||
action_bouton_commencer('clavier')}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -294,8 +306,8 @@ function action_clavier_analyse(event){
|
||||
|
||||
|
||||
|
||||
function init_clavier_tuto(){
|
||||
document.addEventListener("keydown", action_clavier_tuto)
|
||||
function init_clavier_inscription(){
|
||||
document.addEventListener("keydown", action_clavier_inscription)
|
||||
}
|
||||
|
||||
function init_clavier_vues(){
|
||||
@@ -351,21 +363,27 @@ function animate() {
|
||||
// Temps à chaque animate
|
||||
time_animate = new Date().getTime()
|
||||
|
||||
// page tuto
|
||||
if (page_tuto){
|
||||
if (premier_tour_page_tuto){
|
||||
init_clavier_tuto()
|
||||
premier_tour_page_tuto=false}
|
||||
traitement_tuto()
|
||||
// page inscription
|
||||
if (page_inscription){
|
||||
if (premier_tour_page_inscription){
|
||||
init_clavier_inscription()
|
||||
afficher_champs_inscription()
|
||||
premier_tour_page_inscription=false}
|
||||
traitement_inscription()
|
||||
}
|
||||
|
||||
// page de choix
|
||||
if (page_vues && num_tache <= nb_mesh){
|
||||
// on enlève les touches du clavier associé à la page tuto
|
||||
document.removeEventListener("keydown", action_clavier_tuto)
|
||||
// on enlève les touches du clavier associé à la page inscription
|
||||
document.removeEventListener("keydown", action_clavier_inscription)
|
||||
//init touche clavier
|
||||
if(premier_tour_page_vues){
|
||||
//gestion des données personnelle de l'utilisateur
|
||||
gestion_donnees_personnelles()
|
||||
// init clavier pour les vues
|
||||
init_clavier_vues()
|
||||
// affichage ecran 3D
|
||||
setUp_3D(indice_mesh)
|
||||
premier_tour_page_vues = false
|
||||
}
|
||||
// Variable pour les fonctions
|
||||
@@ -403,7 +421,7 @@ function animate() {
|
||||
which_clicked_fleche = -1
|
||||
which_clicked_bouton = -1
|
||||
}
|
||||
|
||||
// page analyse
|
||||
if (page_analyse){
|
||||
// on enlève les touches du clavier associé à la page vues
|
||||
document.removeEventListener("keydown", action_clavier_vues)
|
||||
@@ -415,18 +433,14 @@ function animate() {
|
||||
init_variable_analyse()
|
||||
traitement_fin()
|
||||
}
|
||||
// page finale
|
||||
if (!page_tuto && !page_vues && !page_analyse){
|
||||
// page fin
|
||||
if (!page_inscription && !page_vues && !page_analyse){
|
||||
// on enlève les touches du clavier associé à la page vues
|
||||
document.removeEventListener("keydown", action_clavier_analyse)
|
||||
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight)
|
||||
draw_rectangle(0,0,canvas.width, canvas.height, "rgb(3, 26, 33)", 1)
|
||||
ctx.strokeStyle = "rgb(255, 255, 255)" // Pour que le contour soit rouge
|
||||
ctx.fillStyle = "rgb(255, 255, 255)" // Pour que l'intérieur soit bleu
|
||||
ctx.font = "bold 58pt Courier";
|
||||
ctx.fillText("Done, thx you :)", (window.innerWidth/2)-450, innerHeight/2 -100)
|
||||
console.log('Fin interface3DD')
|
||||
|
||||
// Texte
|
||||
affichage_texte_fin(message_fin, envoie_termine)
|
||||
// ECRITURE DES RESULTATS
|
||||
choix['Analyse'] = checkbox_clicked
|
||||
choix['Interactions'] = interactions
|
||||
@@ -441,12 +455,19 @@ function animate() {
|
||||
// Si la requête est terminée, et que la réponse n'est pas une erreur.
|
||||
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
|
||||
console.log(xhr.responseText);
|
||||
message_fin = "> It's done."
|
||||
//print_text(handle_text(message_fin, (window.innerWidth/2)-450, innerHeight/2+150 , "26pt Courier", 1000))
|
||||
envoie_termine = true
|
||||
affichage_texte_fin(message_fin, envoie_termine)
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Envoi de la requête vers le serveur, avec les données.
|
||||
xhr.send(JSON.stringify(choix));
|
||||
|
||||
return;
|
||||
return
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Boucle sur animate
|
||||
|
||||
@@ -16,3 +16,5 @@ body {
|
||||
background-color: #CCC;
|
||||
position: relative
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user