Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function winnerA() {
  2.     document.getElementById('DesactiverFonctionB').removeAttribute("onclick");
  3.     document.getElementById('DesactiverFonctionA').removeAttribute("onclick");
  4.     var versus = document.getElementById('contenuVersus');
  5.     var posyStart = versus.offsetTop+80;
  6.     var opacityStart = 0;
  7.  
  8.     if (parseInt(nombreVoteObjetA)+1 > parseInt(nombreVoteObjetB)) { //Si objet A gagne
  9.       var posxStart = -window.innerWidth+640; //Initialise stickman à sa position de départ  en X
  10.       var posxEnd = window.innerWidth/2-400; //Initialise stickman à sa position de d'arrivée en X
  11.       document.getElementById("gifA").style.opacity=opacityStart;//Initialise stickman a une opacité de 0 (non visible)
  12.       document.getElementById("gifA").style.left=posxStart+"px"; //Place stickman à sa position de départ en X
  13.       document.getElementById("gifA").style.top=posyStart+"px"; //Place stickman à sa position de départ en Y
  14.       document.getElementById('gifA').removeAttribute("hidden"); //Affiche le à l'écran
  15.       $('#gifA').animate({ //Lance l'annimation de stickman
  16.       opacity: 0.99,
  17.       left: posxEnd //Jusqu'a sa position de fin
  18.     }, 800, 'linear'); // fais le en 3millisecondes
  19.  
  20.       setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  21.         $('#skipNextVersus').animate({
  22.           top: '330',
  23.           opacity: 0.99
  24.         }, 300);
  25.       }, 1800);
  26.  
  27.       setTimeout(function () { //attends 300 millisecondes
  28.         $('.gauche').animate({ //Déplace le background
  29.           width: '80%' // De x % // TODO: valeur a changer par une variable
  30.         }, 1000, 'linear'); // Fais le en 1 secondes
  31.       }, 800);
  32.  
  33.     }else if (parseInt(nombreVoteObjetA)+1 == parseInt(nombreVoteObjetB)) {
  34.       var posxStart = window.innerWidth/2-330;
  35.       document.getElementById("gifA").style.opacity=opacityStart;
  36.       document.getElementById("gifA").style.left=posxStart+"px";
  37.       document.getElementById("gifA").style.top=posyStart+"px";
  38.       document.getElementById('gifA').removeAttribute("hidden");
  39.       $('#gifA').animate({
  40.       opacity: 0.99
  41.     }, 150);
  42.  
  43.     setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  44.       $('#skipNextVersus').animate({
  45.         top: '330',
  46.         opacity: 0.99
  47.       }, 300);
  48.     }, 1800);
  49.  
  50.     }else {
  51.       var posxStart = window.innerWidth-320;
  52.       var posxEnd = window.innerWidth/2-260;
  53.       document.getElementById("gifB").style.left=posxStart+"px";
  54.       document.getElementById("gifB").style.top=posyStart+"px";
  55.       document.getElementById('gifB').removeAttribute("hidden");
  56.       $('#gifB').animate({
  57.       left: posxEnd
  58.     }, 500, 'linear');
  59.       setTimeout(function () {
  60.         $('.gauche').animate({
  61.           width: '0%'
  62.         }, 1000, 'linear');
  63.       }, 500);
  64.  
  65.       setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  66.         $('#skipNextVersus').animate({
  67.           top: '330',
  68.           opacity: 0.99
  69.         }, 300);
  70.       }, 1800);
  71.     }
  72.   }
  73.  
  74.   function winnerB() {
  75.     document.getElementById('DesactiverFonctionA').removeAttribute("onclick");
  76.     document.getElementById('DesactiverFonctionB').removeAttribute("onclick");
  77.     var versus = document.getElementById('contenuVersus');
  78.     var posyStart = versus.offsetTop+80;
  79.     var opacityStart = 0;
  80.  
  81.     if (parseInt(nombreVoteObjetA) > parseInt(nombreVoteObjetB)+1) { //Si objet A gagne
  82.       var posxStart = -window.innerWidth+640; //Initialise stickman à sa position de départ  en X
  83.       var posxEnd = window.innerWidth/2-400; //Initialise stickman à sa position de d'arrivée en X
  84.       document.getElementById("gifA").style.opacity=opacityStart;//Initialise stickman a une opacité de 0 (non visible)
  85.       document.getElementById("gifA").style.left=posxStart+"px"; //Place stickman à sa position de départ en X
  86.       document.getElementById("gifA").style.top=posyStart+"px"; //Place stickman à sa position de départ en Y
  87.       document.getElementById('gifA').removeAttribute("hidden"); //Affiche le à l'écran
  88.       $('#gifA').animate({ //Lance l'annimation de stickman
  89.       opacity: 0.99,
  90.       left: posxEnd //Jusqu'a sa position de fin
  91.     }, 800, 'linear'); // fais le en 3millisecondes
  92.  
  93.       setTimeout(function () { //attends 300 millisecondes
  94.         $('.gauche').animate({ //Déplace le background
  95.           width: '80%' // De x % // TODO: valeur a changer par une variable
  96.         }, 1000, 'linear'); // Fais le en 1 secondes
  97.       }, 800);
  98.  
  99.       setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  100.         $('#skipNextVersus').animate({
  101.           top: '330',
  102.           opacity: 0.99
  103.         }, 300);
  104.       }, 1800);
  105.  
  106.     }else if (parseInt(nombreVoteObjetA) == parseInt(nombreVoteObjetB)+1) {
  107.       var posxStart = window.innerWidth/2-330;
  108.       document.getElementById("gifA").style.opacity=opacityStart;
  109.       document.getElementById("gifA").style.left=posxStart+"px";
  110.       document.getElementById("gifA").style.top=posyStart+"px";
  111.       document.getElementById('gifA').removeAttribute("hidden");
  112.       $('#gifA').animate({
  113.       opacity: 0.99
  114.     }, 150);
  115.  
  116.     setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  117.       $('#skipNextVersus').animate({
  118.         top: '330',
  119.         opacity: 0.99
  120.       }, 300);
  121.     }, 1800);
  122.  
  123.     }else {
  124.       var posxStart = window.innerWidth-320;
  125.       var posxEnd = window.innerWidth/2-260;
  126.       document.getElementById("gifB").style.left=posxStart+"px";
  127.       document.getElementById("gifB").style.top=posyStart+"px";
  128.       document.getElementById('gifB').removeAttribute("hidden");
  129.       $('#gifB').animate({
  130.       left: posxEnd
  131.     }, 500, 'linear');
  132.  
  133.       setTimeout(function () {
  134.         $('.gauche').animate({
  135.           width: '0%'
  136.         }, 1000, 'linear');
  137.       }, 500);
  138.  
  139.       setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
  140.         $('#skipNextVersus').animate({
  141.           top: '330',
  142.           opacity: 0.99
  143.         }, 300);
  144.       }, 1800);
  145.     }
  146.   }
  147.  
  148. function res() {
  149.   alert(window.innerWidth);
  150. }
  151.  
  152. function myFunction() {
  153.     var x = document.getElementById("myTopnav");
  154.     if (x.className === "topnav") {
  155.         x.className += " responsive";
  156.         $('#categorie').animate({
  157.           'margin-top': '464',
  158.         }, 150);
  159.     } else {
  160.         x.className = "topnav";
  161.         $('#categorie').animate({
  162.           'margin-top': '48',
  163.         }, 150);
  164.     }
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement