IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mise en page CSS Discussion :

animate background css


Sujet :

CSS

  1. #1
    Invité
    Invité(e)
    Par défaut animate background css
    hello tout le monde, comment allez vous ?

    j'ai voulu suivre un exemple sur internet qui montrait comment animé une image d'arrière plan en css.
    mais le soucis c'est que mon image ne bouge pas
    voici le code css:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    @keyframes animatedBackground {
    	from { background-position: 0 0; }
    	to { background-position: 100% 0; }
    }
     
    #animate-area {
    background: #f5f0e0 url(../images/noise3.png);
    background-position: 0px 0px;
    background-repeat: repeat-y;
    animation: animatedBackground 40s linear infinite;
    border: 5px solid #7FD0A1;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    -moz-box-shadow: 0px 0px 70px #000000;
    -webkit-box-shadow: 0px 0px 70px #000000;
    box-shadow: 0px 0px 70px #000000;
     
    }
    savez vous pourquoi l'image ne bouge ?
    merci d'avance

  2. #2
    Membre Expert
    Avatar de rodolphebrd
    Homme Profil pro
    Indépendant
    Inscrit en
    Novembre 2012
    Messages
    2 336
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Indépendant
    Secteur : Conseil

    Informations forums :
    Inscription : Novembre 2012
    Messages : 2 336
    Par défaut
    Bonjour,

    N'avez-vous pas oublié les préfixes ?

  3. #3
    Invité
    Invité(e)
    Par défaut
    un préfixe c'est a dire un webkit ?
    j'utilise chrome pour tester et dans l'exemple il montrait que se bout de code avec une démo qui fonctionnait très bien
    voila le site en question http://davidwalsh.name/background-animation-css

  4. #4
    Membre Expert
    Avatar de rodolphebrd
    Homme Profil pro
    Indépendant
    Inscrit en
    Novembre 2012
    Messages
    2 336
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Indépendant
    Secteur : Conseil

    Informations forums :
    Inscription : Novembre 2012
    Messages : 2 336
    Par défaut
    Ben un préfixe comme ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    @keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 100% 0; }
    		}
    		@-webkit-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 100% 0; }
    		}
    		@-ms-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 100% 0; }
    		}
    		@-moz-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 100% 0; }
    		}
    #animate-area {
    width: 560px;
    height: 400px;
    background-image: url(http://davidwalsh.name/demo/bg-clouds.png);
    background-position: 0px 0px;
    background-repeat: repeat-x;
    animation: animatedBackground 40s linear infinite;
    -ms-animation: animatedBackground 40s linear infinite;
    -moz-animation: animatedBackground 40s linear infinite;
    -webkit-animation: animatedBackground 40s linear infinite;
    }
    http://codepen.io/anon/pen/lmItL

  5. #5
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Billets dans le blog
    20
    Par défaut
    Citation Envoyé par Morpheus500
    il montrait que se bout de code avec une démo qui fonctionnait très bien
    Tu as probablement oublié de lire le texte correspondant au code, notamment la partie :
    Of course the mess of vendor prefixes to accomplish the animation sucks


    Certes, pour des raisons de concision, l'article n'intègre pas les préfixes vendeurs, mais il est quand même indiqué de les utiliser ! Sans parler du code source de la démo où ils apparaissent clairement.
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  6. #6
    Invité
    Invité(e)
    Par défaut
    j'ai rajouté se qu'il manquait l'image bouge mais de façon horizontale, de droite a gauche. moi je voulait que l'animation fait de haut en bas, en vertical
    alors j'ai trouvé cette exemple: http://debray-jerome.developpez.com/...tions-en-css3/

    mais sa ne marche pas l'image ne bouge pas

    faut il remplacer animated par translate ?
    Dernière modification par Invité ; 26/08/2013 à 17h37.

  7. #7
    Membre Expert
    Avatar de rodolphebrd
    Homme Profil pro
    Indépendant
    Inscrit en
    Novembre 2012
    Messages
    2 336
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Indépendant
    Secteur : Conseil

    Informations forums :
    Inscription : Novembre 2012
    Messages : 2 336
    Par défaut
    Il faut changer les valeurs des background-position dans les keyframes et mettre un repeat-y :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    @keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    		@-webkit-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    		@-ms-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    		@-moz-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    #animate-area {
    width: 560px;
    height: 400px;
    background-image: url(http://davidwalsh.name/demo/bg-clouds.png);
    background-position: 0px 0px;
    background-repeat: repeat-y;
    animation: animatedBackground 40s linear infinite;
    -ms-animation: animatedBackground 40s linear infinite;
    -moz-animation: animatedBackground 40s linear infinite;
    -webkit-animation: animatedBackground 40s linear infinite;
    }
    http://codepen.io/anon/pen/umcIk

    Bien sûr avec l'image adéquat se sera mieux. ^^

  8. #8
    Invité
    Invité(e)
    Par défaut
    voici mon nouveau code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    }
    @keyframes animatedBackground {
    	from { background-position: 0 0; }
    	to { background-position: 0 100%; }
    }
    @-webkit-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    @-ms-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
    @-moz-keyframes animatedBackground {
    			from { background-position: 0 0; }
    			to { background-position: 0 100%; }
    		}
     
    #animate-area {
    background: #f5f0e0 url(../images/noise3.png);
    background-position: 0px 0px;
    background-repeat: repeat-y;
        animation: animatedBackground 5s linear infinite;
        -ms-animation: animatedBackground 5s linear infinite;
    	-moz-animation: animatedBackground 5s linear infinite;
    	-webkit-animation: animatedBackground 5s linear infinite;
    border: 5px solid #7FD0A1;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    -moz-box-shadow: 0px 0px 70px #000000;
    -webkit-box-shadow: 0px 0px 70px #000000;
    box-shadow: 0px 0px 70px #000000;
    effectivement merci, l'image bouge bien de haut en bas mais elle se répète a chaque fois et on aperçois une coupure, il faudrait peut être que j'agrandisse l'image du background pour quelle soit 10 fois plus grande, pour que l'animation bouge un peu plus longtemps.

    je ne sais pas si background-position: 0px 0px; sert bien a quelle que chose maintenant

Discussions similaires

  1. [Dojo] dojo.animateProperty : Animer les Css
    Par Zineb1987_UNI dans le forum Bibliothèques & Frameworks
    Réponses: 11
    Dernier message: 29/10/2009, 17h47
  2. Animation en CSS
    Par popy67 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 12/02/2008, 23h45
  3. Background css selectionnable
    Par tchoukapi dans le forum Mise en page CSS
    Réponses: 7
    Dernier message: 15/01/2007, 16h15

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo