Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================
- ======== CSS - ANIMATION - TRANSFORMATION v.1 - POSTé
- ============================
- ============================
- =========== Exemple PERSO - EDU Sans Frontiére =
- == http://www.educationsansfrontieres.org/rubrique461.html
- .la.pas_recent .ancre1 .intro {
- /* visibility: visible;*/
- opacity: 0 !important;
- width: 148% !important;
- }
- .la.pas_recent:hover .ancre1 .intro {
- /* visibility: visible;*/
- opacity: 1 !important;
- width: 148% !important;
- -moz-transition: 1s opacity ease !important;
- }
- ============================
- =========== ANIMATION TRANSFORM 3D : translate3d
- == http://www.pageresource.com/css3/3d-transforms-tutorial/
- .masonry_box.board_info_box + .small_pin_box {
- /* transform: translate3d(-283px, 0px, 0px) !important; */
- /* position: relative !important; */
- display: inline-block !important;
- /* float: left !important;
- clear: left !important; */
- max-height: 200px !important;
- min-height: 200px !important;
- left: -14% !important;
- bottom: 5px !important;
- padding: 5px 1px 5px 5px !important;
- border-radius: 3px;
- box-shadow: 6px 5px 6px black !important;
- /* box-shadow: 2px 2px 2px rgba(162, 160, 160, 0.9) !important;*/
- font-size: 11px;
- border: 1px solid gray !important;
- background-color: #222222 !important;
- overflow: hidden !important;
- }
- ============================
- =========== ANIMATION KEYFRAME INFO : you can't use !important in @keyframes rule.
- == https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
- == https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations
- Configuring the animation:
- To create a CSS animation sequence,
- you style the element you want to animate with
- the animation property or its sub-properties.
- This lets you configure the timing and duration of the animation,
- as well as other details of how the animation sequence should progress.
- This does not configure the actual appearance of the animation,
- which is done using the @keyframes at-rule as described
- in Defining the animation sequence using keyframes below.
- The sub-properties of the animation property are:
- animation-delay
- Configures the delay between the time the element is loaded and the beginning of the animation sequence.
- animation-direction
- Configures whether or not the animation should alternate direction on each run through the sequence or reset to the start point and repeat itself.
- animation-duration
- Configures the length of time that an animation should take to complete one cycle.
- animation-iteration-count
- Configures the number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely.
- animation-name
- Specifies the name of the @keyframes at-rule describing the animation's keyframes.
- animation-play-state
- Lets you pause and resume the animation sequence.
- animation-timing-function
- Configures the timing of the animation; that is, how the animation transitions through keyframes, by establishing acceleration curves.
- animation-fill-mode
- Configures what values are applied by the animation before and after it is executing.
- == ANIMATION KEYFRAME - EXAMPLE @keyframe
- ==
- @keyframes makando_fade {
- from { opacity: 0;}
- to {opacity: 1;}
- }
- #view-code {
- -moz-animation-name: makando_fade;
- -moz-animation-duration: 2s;
- -moz-animation-delay: 0.5s;
- -moz-animation-direction: reverse;
- -moz-animation-fill-mode: forwards;
- }
- #view-code:hover {
- opacity: 1 !important;
- }
- ============================
- =========== ANIMATION KEYFRAME - EXAMPLE @keyframe
- == TEXTE - BLINK : NEW SOLUTION: Imitating a blink tag with CSS3 animations
- == http://stackoverflow.com/questions/13955163/imitating-a-blink-tag-with-css3-animations
- blink {
- display: inline;
- color: inherit;
- animation: blink 1s steps(1) infinite;
- -webkit-animation: blink 1s steps(1) infinite;
- }
- @keyframes blink { 50% { color: transparent; } }
- @-webkit-keyframes blink { 50% { color: transparent; } }
- == EXAMPLE @keyframe
- == GLOSS SHADOW
- == http://jsfiddle.net/T88X5/3/light/
- body { font-family: Arial, Helvetica, "Liberation Sans", sans-serif; }
- #loader {
- background: #ddd;
- color: #333;
- border-radius: 4px;
- padding: 4px;
- display: inline-block;
- -webkit-box-shadow: 0 0 5px #333;
- box-shadow: 0 0 5px #333;
- -moz-animation-name: glow;
- -moz-animation-duration: .8s;
- -moz-animation-iteration-count: infinite;
- -moz-animation-timing-function: linear;
- -moz-animation-direction: alternate;
- -webkit-animation-name: glow;
- -webkit-animation-duration: .8s;
- -webkit-animation-iteration-count: infinite;
- -webkit-animation-timing-function: linear;
- -webkit-animation-direction: alternate;
- }
- @-moz-keyframes glow {
- from { box-shadow: 0 0 5px #333; }
- to { box-shadow: 0 0 10px #046; }
- }
- @-webkit-keyframes glow {
- from { -webkit-box-shadow: 0 0 5px #333; }
- to { -webkit-box-shadow: 0 0 10px #046; }
- }
- ============================
- =========== A ETUDIER : ANIMATION =
- ==http://leaverou.github.com/animatable/
- ==EXEMPLE :
- #on-hover:checked ~ div[role="main"] > a[data-property]:not(:hover):not(:target),
- body.in-page a[data-property]:not(:target) {
- -moz-animation: 0s ease 0s normal none 1 none !important;
- }
- ======== A ETUDIER : ANIMATION SLIDEBOX ARROWS
- == https://developer.mozilla.org/en-US/demos/detail/paperfold-css
- == ARROW SPRITES : https://developer.cdn.mozilla.net/media/img/demos/nav-slide.png
- #demobox .slider .panel {
- margin: 0;
- }
- #demobox .nav-slide {
- list-style: none outside none;
- margin: 0;
- padding: 0;
- }
- #demobox .nav-slide a {
- background: url("../img/demos/nav-slide.png") no-repeat scroll 0 0 transparent;
- height: 65px;
- opacity: 0.85;
- overflow: hidden;
- position: absolute;
- text-indent: -999em;
- top: 40%;
- width: 65px;
- z-index: 30;
- }
- #demobox .nav-slide .next {
- background-position: 0 0;
- right: -65px;
- }
- #demobox .nav-slide .next:hover, #featured-demos .nav-slide .next:focus, #featured-demos .nav-slide .next:active {
- background-position: 0 -100px;
- }
- #demobox .nav-slide .prev {
- background-position: 0 -200px;
- left: -65px;
- }
- #demobox .nav-slide .prev:hover, #featured-demos .nav-slide .prev:focus, #featured-demos .nav-slide .prev:active {
- background-position: 0 -300px;
- }
- ============================
- ======== CSS transform-origin - -moz-transform-origin:
- == https://www.google.fr/search?q=transform+css&ie=utf-8&oe=utf-8&rls=org.mozilla:fr:official&client=firefox-a&gws_rd=cr&ei=u6inUuTRHcib0QWjgoG4DA&safe=off
- == http://www.alsacreations.com/article/lire/1418-css3-transformations-2d.html
- Pour pouvoir appliquer des transformations, nous avons besoin de savoir
- quel est le point d'origine (d'ancrage) de la transformation.
- La propriété transform-origin définit ce point d'origine.
- La valeur initiale de cette propriété est le centre de l'élément,
- ce qui équivaut à la notation :
- transform-origin: 50% 50%;
- Il est possible de changer cette valeur en utilisant
- un mot-clef de position (top, right, bottom, left)
- suivi d'une valeur chiffrée dont l'unité peut varier (px, %, etc.)
- div {
- transform-origin: top 0 left 0;
- transform: scale(1.25);
- }
- Il s'agit là de la syntaxe proposée par le W3C.
- À l'heure actuelle (2012) aucun navigateur n'implémente cette syntaxe correctement.
- Cependant, il suffit de supprimer les mots-clefs de position pour obtenir des résultats
- sur tous les navigateurs récents
- (toujours à condition d'utiliser les préfixes vendeurs -webkit-,-moz-,-ms-,-o- selon les versions);
- Quelques exemples de positionnements :
- Point d'origine en haut à gauche :
- transform-origin: 0 0;
- -moz-transform-origin: 0 0 !important;
- Point d'origine en bas à droite :
- transform-origin: 100% 100%;
- -moz-transform-origin: 100% 100% !important;
- Point d'origine en bas et centré:
- transform-origin: 50% 100%;
- -moz-transform-origin: 50% 100% !important;
- ============================
- ======== CSS transform - transform
- == http://www.alsacreations.com/article/lire/1418-css3-transformations-2d.html
- Une fois l'origine choisie, nous pouvons affecter
- des transformations à nos éléments avec la propriété transform.
- ==== La fonction translate
- Elle permet d'effectuer une translation (un déplacement) de l'élément
- sur les axes X et Y.
- Il n'y a ici aucune notion de flux, l'élément part de son emplacement courant,
- quel que soit le type de positionnement que vous lui aurez attribué.
- transform: translate(x,y);
- y est une valeur optionnelle équivalente à 0 si elle n'est pas renseignée.
- Les deux valeurs peuvent être négatives.
- ==== Les fonctions translateX et translateY
- Ces fonctions permettent de réaliser une translation sur l'axe X (translateX) ou Y (translateY).
- transform: translateX(value) translateY(value);
- Si vous pensiez comme moi que ces fonctions permettent une modification
- de l'une des deux valeurs du vecteur initial,
- dans le cas par exemple où la transformation vient en écraser une autre,
- alors vous faites erreur. Essayez le code suivant pour comprendre :
- div {
- transform: translate(20px, 35px);
- }
- div:hover {
- /* redéfinition de la valeur X ? */
- transform: translateX(20px);
- }
- En définissant uniquement translateX sur l'évènement :hover,
- translateY est implicitement redéfini avec la valeur 0.
- ==== La fonction scale
- Cette fonction permet d'agir sur l'échelle (les dimensions) de l'élément.
- La valeur initiale est 1, tandis que les valeurs supérieures à 1 créent un effet d'agrandissement,
- et les valeurs inférieures créent un effet de réduction.
- transform: scale(x,y);
- La valeur y est optionnelle et sera égale à la valeur de x si elle est non renseignée,
- par exemple pour un agrandissement d'un facteur 1.25 :
- transform: scale(1.25);
- Les valeurs de x et y peuvent être aussi négatives.
- Il est possible d'effectuer ce "zoom" sur tous les éléments a priori...
- mais ce n'est pas parce que vous pouvez le faire qu'il faut le faire.
- N'oubliez pas qu'une image agrandie pourra être floue ou mal interpolée
- selon sa résolution initiale et celle de l'écran de destination.
- ==== Les fonctions scaleX et scaleY
- Sur le même principe que pour les fonctions dérivées de translate,
- ces deux fonctions permettent de définir indépendamment les valeurs x et y.
- Si scaleX est uniquement renseigné, scaleY vaudra implicitement 1
- (aucun effet de scale en y donc), et inversement.
- transform: scaleY(1.25);
- Cette transformation va élargir l'élément ainsi que son contenu éventuel.
- Il suffit de regarder la démonstration suivante pour constater la transformation
- (prêtez attention au texte de l'encadré vert).
- ============================
- ======== A ETUDIER :
- == http://robertnyman.com/css3/css-transitions/css-transitions-simple.html
- CSS3 Transitions - To: CSS3 - Information and samples
- Hover over the paragraph below to see a CSS Transition in action.
- /* Shorthand version */
- #hello {
- display: inline-block;
- border: 1px dashed #000;
- padding: 10px;
- background: #ffffa2;
- height: 20px;
- opacity: 0.3;
- /* Firefox */
- -moz-transition: height 1s ease-out, opacity 1s ease;
- /* WebKit */
- -webkit-transition: height 1s ease-out, opacity 1s ease;
- /* Opera */
- -o-transition: height 1s ease-out, opacity 1s ease;
- /* Standard */
- transition: height 1s ease-out, opacity 1s ease;
- }
- #hello:hover {
- height: 40px;
- opacity: 1;
- }
- ============================
- ======== ANIMATION : TRANSITION > RADIUS
- == http://www.tutorialsavvy.com/2013/01/css3-transition.html
- In Css3 we can show transition of an object using transition property. Variation of this properties for different browsers are transition,-moz-transition, -moz-transform ,-webkit-transition, -webkit-transform,-o-transition.
- The other transition properties have duration,property,delay and timing function to control the css3 transition.
- <!DOCTYPE html>
- <html>
- <head>
- <title>CSS3 Transition Demo</title>
- <style>
- div.name {
- color:white;
- text-align:center;
- padding:100px;
- width:100px;
- height:75px;
- background:black;
- border:4px solid red;
- border-radius:0px;
- transition:border 2s, border-radius 2s, color 2s;
- -moz-transition:border 2s, border-radius 2s;
- -webkit-transition:border 2s, border-radius 2s;
- -o-transition:border 2s, border-radius 2s;
- }
- div.name:hover {
- border-radius:400px;
- border:4px solid yellow;
- background:green;
- color:yellow;
- }
- </style>
- </head>
- <body>
- <div class="name">SANDEEP</div>
- </body>
- ============================
- =========== ANIMATION : TRANSITION: all 200ms linear; + transform: translateZ(0);
- CSS3 MAGNIFICATION / ENLARGE / SCALE EFFECT
- == http://www.priteshgupta.com/2011/06/html5-magnification-enlarge-scale-effect/
- Default CSS for the element :
- -webkit-transition: all 200ms linear;
- -moz-transition: all 200ms linear;
- -o-transition: all 200ms linear;
- transition: all 200ms linear;
- -webkit-transform: translateZ(0);
- -moz-transform: translateZ(0);
- -o-transform: translateZ(0);
- transform: translateZ(0);
- Hover CSS for the element :
- -webkit-transform: scale(1.1) translateZ(0);
- -moz-transform: scale(1.1) translateZ(0);
- -o-transform: scale(1.1) translateZ(0);
- transform: scale(1.1) translateZ(0);
- ============================
- ======== ANIMATION : TRANSITION
- Pour définir une nouvelle transition animée,
- il est nécessaire de préciser au minimum 2 composantes :
- • la (ou les) propriété(s) à animer (transition-property) ;
- • la durée de l’animation (transition-duration).
- ==Exemple pour comprendre le principe général :
- img {
- width: 50px; /* état par défaut */
- transition-property: width; /* transition de la propriété width au survol de la souris */
- transition-duration: 1s; /* durée de la transition */
- }
- img:hover {
- width: 200px;
- }
- == 2 propriétés minimales nécessaires :
- - transition-property
- - transition-duration.
- Il existe cependant d’autres propriétés CSS spécifiques aux transitions :
- - transition-timing-function
- - transition-delay
- - notation raccourcie transition, qui cumule tous ces aspects.
- ==Propriété à animer :
- transition-property
- La propriété transition-property accepte trois valeurs :
- • all (valeur par défaut) : toutes les propriétés possibles seront animées ;
- • propriété : le nom d’une propriété pouvant être animée ;
- • none : aucune propriété ne sera animée.
- ========= Accélération
- La propriété transition-timing-function détermine la fluidité de l’animation.
- Les mots-clés admissibles pour cette propriété :
- • ease : rapide sur le début et ralenti sur la fin ;
- • linear (valeur par défaut) : vitesse constante sur toute la durée de l’animation ;
- • ease-in : lent sur le début et accélère de plus en plus vers la fin ;
- • ease-out : rapide sur le début et décélère sur la fin ;
- • ease-in-out : le départ et la fin sont lents.
- ======== Transition Notation raccourcie :
- La notation raccourcien permet de décrire facilement et de manière concise les différentes
- propriétés en jeu à l’aide d’une seule propriété. La syntaxe est la suivante :
- selecteur {
- transition: <transition-property> <transition-duration> <transition-timing-function> <transition-delay>;
- }
- ==Exemple transition 1 seconde de toutes les propriétés d’une image lors de son survol :
- img {
- transition: all 1s ease-in;
- }
- ============================
- ======== ANIMATION : Keyframes
- ==http://www.alsacreations.com/tuto/lire/1059-ID-slideshow-css3-animation-keyframes-automatique.html
- ==http://www.netmagazine.com/features/top-10-css3-techniques
- Quelques propriétés d'animation liées au en CSS3 Nom de la propriété:
- === ANIMATION-NAME
- Le nom de l'animation à utiliser sur l'élément ciblé
- === ANIMATION-DURATION
- La durée de l'animation, définit la durée entre 0% et 100% (from et to)
- Valeur : durée (ms, s, etc.)
- === ANIMATION-ITERATION-COUNT
- Nombre de boucle (répétition que dois faire l'animation).
- Valeur :
- nombre ou infinite
- === ANIMATION-TIMING-FUNCTION
- Fonction de modification de l'interpolation de l'animation.
- Valeur :
- ease-in,
- ease-out,
- ease-in-out, etc.
- === ANIMATION-DIRECTION
- Comportement de la tête de lecture de l'animation (sens de lecture)
- Valeur :
- alternate,
- normal
- === ANIMATION-DELAY
- Impose un délais avant le début de l'animation
- Valeur :
- durée (ms, s, etc)
- ===ANIMATION-PLAY-STATE
- Statut de lecture de l'animation
- Valeur :
- running,
- paused
- ============================
- ======== ANIMATION : TRANSITION / TARGET : VOLET COULISSANT ==:target + transition
- ==http://www.netmagazine.com/features/top-10-css3-techniques
- ==http://www.alsacreations.com/tuto/lire/1234-creer-volet-coulissant-CSS3-target-transition.html
- ==http://www.alsacreations.com/tuto/lire/1052-ID-slideshow-css3-target-animation-keyframes-introduction.html
- ============================
- ======== ANIMATION : TRANSITION / HOVER /
- ==http://www.css3create.com/Menu-avec-slider-effet-transition
- Menu avec slider effet transition === -moz-transition
- -moz-transition, -webkit-transition
- et les autres transitions pour gérer un effet de slide sur un menu.
- ==Exemple : -moz-transition + OPACITY
- Lors du hover "on" sur un lien, on déplace la div sur la gauche (left),
- on augmente sa visualisation (opacity) et sa taille (width), grace aux transitions :
- ul li:hover div{
- left:182px;opacity:1;width:276px;
- -moz-transition:1s left,1s width,1s opacity;
- }
- Lors du hover "out", on ré-utilise la transition
- mais pour repositionner la div dans son état d’origine :
- ul li div{
- left:0px;opacity:0;width:152px;
- -moz-transition:1s left,1s width,1s opacity;
- }
- ============================
- ======== ANIMATION : TRANSITION / HOVER == DEMO == Image with sliding description panel using CSS3 transitions
- == http://www.dynamicdrive.com/style/csslibrary/item/image_with_sliding_description_panel_using_css3_transitions/
- CSS example shows how to add an animated description panel to images
- that slides open when the mouse rolls over the image using CSS3 transitions.
- By wrapping the image inside a relatively positioned container alongside a newly injected description DIV
- to house the description itself, we can slide the later into view using CSS3's transform:translate() property.
- All four sliding directions are shown below (up, down, right, or left).
- The onset of the sliding animation is delayed by 0.5 seconds each time using the transition-delay property,
- so it occurs after that of the CSS3 shadow being added to the image to create the effect of a raised image.
- The result is a cool image with a sliding description panel that uses nothing more than HTML/ CSS to create the effect.
- The following works best in a modern browser that supports CSS3 transitions, namely, IE10+, FF3.5+,
- Chrome/Safari, and Opera 10. Lesser browsers such as IE9 will still see the description panel onMouseover, just sans the transition:
- <style>
- .imagepluscontainer{ /* main image container */
- position: relative;
- z-index: 1;
- }
- .imagepluscontainer img{ /* CSS for image within container */
- position: relative;
- z-index: 2;
- -moz-transition: all 0.5s ease; /* Enable CSS3 transition on all props */
- -webkit-transition: all 0.5s ease-in-out;
- -o-transition: all 0.5s ease-in-out;
- -ms-transition: all 0.5s ease-in-out;
- transition: all 0.5s ease-in-out;
- }
- .imagepluscontainer:hover img{ /* CSS for image when mouse hovers over main container */
- -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
- box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
- -moz-transform: scale(1.05, 1.05);
- -webkit-transform: scale(1.05, 1.05);
- -ms-transform: scale(1.05, 1.05);
- -o-transform: scale(1.05, 1.05);
- transform: scale(1.05, 1.05);
- }
- .imagepluscontainer div.desc{ /* CSS for desc div of each image. */
- position: absolute;
- width: 90%;
- z-index: 1; /* Set z-index to that less than image's, so it's hidden beneath it */
- bottom: 0; /* Default position of desc div is bottom of container, setting it up to slide down */
- left: 5px;
- padding: 8px;
- background: rgba(0, 0, 0, 0.8); /* black bg with 80% opacity */
- color: white;
- -moz-border-radius: 0 0 8px 8px; /* CSS3 rounded borders */
- -webkit-border-radius: 0 0 8px 8px;
- border-radius: 0 0 8px 8px;
- opacity: 0; /* Set initial opacity to 0 */
- -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.8); /* CSS3 shadows */
- -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
- box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
- -moz-transition: all 0.5s ease 0.5s; /* Enable CSS3 transition on desc div. Final 0.5s value is the delay before animation starts */
- -webkit-transition: all 0.5s ease 0.5s;
- -o-transition: all 0.5s ease 0.5s;
- -ms-transition: all 0.5s ease 0.5s;
- transition: all 0.5s ease 0.5s;
- }
- .imagepluscontainer div.desc a{
- color: white;
- }
- .imagepluscontainer:hover div.desc{ /* CSS for desc div when mouse hovers over main container */
- -moz-transform: translate(0, 100%);
- -webkit-transform: translate(0, 100%);
- -ms-transform: translate(0, 100%);
- -o-transform: translate(0, 100%);
- transform: translate(0, 100%);
- opacity:1; /* Reveal desc DIV fully */
- }
- /*### Below CSS when applied to desc DIV slides the desc div from the right edge of the image ###*/
- .imagepluscontainer div.rightslide{
- width: 150px; /* reset from default */
- top:15px;
- right:0;
- left:auto; /* reset from default */
- bottom:auto; /* reset from default */
- padding-left:15px;
- -moz-border-radius: 0 8px 8px 0;
- -webkit-border-radius: 0 8px 8px 0;
- border-radius: 0 8px 8px 0;
- }
- .imagepluscontainer:hover div.rightslide{
- -moz-transform: translate(100%, 0);
- -webkit-transform: translate(100%, 0);
- -ms-transform: translate(100%, 0);
- -o-transform: translate(100%, 0);
- transform: translate(100%, 0);
- }
- /*### Below CSS when applied to desc DIV slides the desc div from the left edge of the image ###*/
- .imagepluscontainer div.leftslide{
- width: 150px; /* reset from default */
- top:15px;
- left:0;
- bottom:auto; /* reset from default */
- padding-left:15px;
- -moz-border-radius: 8px 0 0 8px;
- -webkit-border-radius: 8px 0 0 8px;
- border-radius: 8px 0 0 8px;
- }
- .imagepluscontainer:hover div.leftslide{
- -moz-transform: translate(-100%, 0);
- -webkit-transform: translate(-100%, 0);
- -ms-transform: translate(-100%, 0);
- -o-transform: translate(-100%, 0);
- transform:translate(-100%, 0);
- }
- /*### Below CSS when applied to desc DIV slides the desc div from the top edge of the image ###*/
- .imagepluscontainer div.upslide{
- top:0;
- bottom:auto; /* reset from default */
- padding-bottom:10px;
- -moz-border-radius: 8px 8px 0 0;
- -webkit-border-radius: 8px 8px 0 0;
- border-radius: 8px 8px 0 0;
- }
- .imagepluscontainer:hover div.upslide{
- -moz-transform: translate(0, -100%);
- -webkit-transform: translate(0, -100%);
- -ms-transform: translate(0, -100%);
- -o-transform: translate(0, -100%);
- transform:translate(0, -100%);
- }
- </style>
- ============================
- ======== ANIMATION : TRANSITION [ -moz-transition / -webkit-transition and without Vendor ] + (by example : property , duration , opacity ):
- == http://coding.smashingmagazine.com/2009/12/19/what-you-need-to-know-about-behavioral-css/
- Define and moves an element from its inactive state (e.g. dark-blue background)
- to its hover or active state (e.g. light-blue background).
- Can be coupled with transformations (and trigger events such as :hover or :focus)
- to create a kind of animation :
- =Exemple :
- Fading the background color, sliding a block and spinning an object can all be done with CSS transitions:
- #nav a{
- background-color:red;
- }
- #nav a:hover,
- #nav a:focus{
- background-color:blue;
- /* tell the transition to apply to background-color (looks like a CSS variable, doesn't it? #foreshadowing)*/
- -webkit-transition-property:background-color;
- /* make it 2 seconds long */
- -webkit-transition-duration:2s;
- }
- ============================
- ======== ANIMATION : TRANSFORM SCALE [ -webkit-transform / -moz-transform / -o-transform ] X ou Y :scale or scale(1.1, 1.1)
- ==http://www.netmagazine.com/features/top-10-css3-techniques
- ==http://www.w3schools.com/cssref/css3_pr_transform.asp
- -moz-transform:scaleX(0.5)!important;
- -moz-transform:scaleY(0.5)!important;
- ==Exemple perso :
- -moz-transform: scale(1.1, 1.1) !important;
- ============================
- ======== ANIMATION : TRANSFORM TRANSLATE [ -webkit-transform / -moz-transform / -o-transform ]: translate(15px, -15px);
- transform: translate(15px, -15px);
- ==http://www.netmagazine.com/features/top-10-css3-techniques
- ==http://coding.smashingmagazine.com/2009/12/19/what-you-need-to-know-about-behavioral-css/
- ==http://www.standardista.com/css3-transforms/
- === translate() :
- The translate(x, y) function is similar to relative positioning, translating, or relocating, an element by x from the left, and y from the top.
- -webkit-transform: translate(15px, -15px);
- -moz-transform: translate(15px, -15px);
- -o-transform: translate(15px, -15px);
- transform: translate(15px, -15px);
- ===translateX() :
- The translateX(x) function is similar to the translate() function above, but only the left/right value is specified
- -webkit-transform: translatex(15px);
- -moz-transform: translatex(15px);
- -o-transform: translatex(15px);
- transform: translatex(15px);
- ===translateY() :
- The translateY(y) function is similar to the translate() function above, but only the top/bottom value is specified
- -webkit-transform: translatey(-15px);
- -moz-transform: translatey(-15px);
- -o-transform: translatey(-15px);
- transform: translatey(-15px);
- ============================
- ======== ANIMATION : TRANSFORM TRANSLATE [ -moz-transform / -webkit-transform ]: translate
- ==http://coding.smashingmagazine.com/2009/12/19/what-you-need-to-know-about-behavioral-css/
- You can move, turn, zoom in on and manipulate any inline or block-level element without JavaScript :
- Positioning elements using X and Y values
- ==transform translate example :
- #nav{
- /* This will move the #nav element left 10 pixels and down 20 pixels. */
- -moz-transform: translate(10px, 20px);
- -webkit-transform: translate(10px, 20px);
- }
- == Chaining Transformations :
- #nav{
- -moz-transform: translate(10, 25);
- -webkit-transform: translate(10, 25);
- -moz-transform: rotate(90deg);
- -webkit-transform: rotate(90deg);
- -moz-transform: scale(2, 1);
- -webkit-transform: scale(2, 1);
- }
- Chained together to make your CSS more efficient:
- #nav{
- -moz-transform: translate(10, 25) rotate(90deg) scale(2, 1);
- -webkit-transform: translate(10, 25) rotate(90deg) scale(2, 1);
- }
- ============================
- ======== ANIMATION : TRANSFORM TRANSLATE [ -moz-transform / -webkit-transform ]: translate
- ==http://css3clickchart.com/?prop=translate-transform
- =Position an element vertically and/or horizontally,
- similar to CSS positioning, using a function as a value for the transform property:
- .element {
- -webkit-transform: translate(25px, 50px);
- -moz-transform: translate(25px, 50px);
- -o-transform: translate(25px, 50px);
- -ms-transform: translate(25px, 50px);
- transform: translate(25px, 50px);
- }
- ============================
- ======== ANIMATION :
- == http://leaverou.github.com/animatable/
- ==EXEMPLE :
- #on-hover:checked ~ div[role="main"] > a[data-property]:not(:hover):not(:target),
- body.in-page a[data-property]:not(:target) {
- -moz-animation: 0s ease 0s normal none 1 none !important;
- }
- ============================
- ======== ANIMATION : Accordion (A VOIR))
- ==http://jsdo.it/jasmine88/ya52
- .ac-container article{
- background: rgba(255,255,255,0.5);
- margin-top: -1px;
- overflow: hidden;
- height: 0px;
- position: relative;
- z-index: 10;
- transition:height 0.3s ease-in-out, box-shadow 0.6s linear;
- -moz-transition:height 0.3s ease-in-out, box-shadow 0.6s linear;
- -webkit-transition:height 0.3s ease-in-out, box-shadow 0.6s linear;
- }
- .ac-container input:checked ~ article{
- transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
- -moz-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
- -webkit-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
- box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.5);
- -moz-box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.5);
- -webkit-box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.5);
- }
- ============================
- ======== ANIMATION : Accordion ===:target pseudo-class
- ==http://www.paulrhayes.com/2009-06/accordion-using-only-css/
- ==http://www.aplweb.co.uk/blog/css/pure-css3-accordion/
- Using -webkit-transition Accordion can also be animated.
- How To:
- Each part of the accordion has an ID, heading and content region.
- The header includes a link that matches the section’s ID,
- whilst the content is wrapped in a container which will control its display.
- <div class="accordion">
- <h2>Accordion Demo</h2>
- <div id="one" class="section">
- <h3>
- <a href="#one">Heading 1</a>
- </h3>
- <div>
- <p>Content</p>
- </div>
- </div>
- <div id="two" class="section">
- <h3>
- <a href="#two">Heading 2</a>
- </h3>
- <div>
- <p>Content</p>
- </div>
- </div>
- </div>
- The CSS then relies on the :target pseudo-class to apply different styles to the chosen section :
- - increasing the height and, in large content cases, altering the overflow behaviour to allow scrolling.
- To animate the opening and closing of sections the -webkit-transition property is needed ,
- in this case acting on the height attribute for a duration of 0.3 seconds using the easein timing function.
- Stripping out the styling, the CSS boils down to:
- .accordion h3 + div {
- height: 0;
- overflow: hidden;
- -webkit-transition: height 0.3s ease-in;
- }
- .accordion :target h3 + div {
- height: 100px;
- }
- .accordion .section.large:target h3 + div {
- overflow: auto;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement