2011-11-03 7 views
41

Si Google, 'hacer un barril de rodillos', toda la página hace una rotación de 360 ​​grados. ¿Alguien tiene alguna idea de cómo Google está haciendo esto? Inhabilité javascript, y todavía ocurrió, ¿entonces tal vez una rotación css?¿Cómo hace google el barril?

+2

Es muy probable que la rotación de CSS. –

Respuesta

21

Si nos fijamos en el código CSS:

body { 
    -moz-animation-duration: 4s; 
    -moz-animation-iteration-count: 1; 
    -moz-animation-name: roll; 
} 
+6

donde roll es algo así como @ -webkit-keyframes roll { \t desde {-webkit-transform: rotate (0); } \t a {-webkit-transform: rotate (360deg); } } – wave

+7

¡Las animaciones de JavaScript molestas están muertas! Todos saludan odiosas animaciones CSS! –

1

suena como una rotación CSS3 transformation aplicado a las etiquetas ya sea del cuerpo o html

2

Se utiliza animaciones CSS personalizados. Ver las reglas CSS aplicados a la <body> aquí:

body { 
    -moz-animation-name: roll; 
    -moz-animation-duration: 4s; 
    -moz-animation-iteration-count: 1; 
    -o-animation-name: roll; 
    -o-animation-duration: 4s; 
    -o-animation-iteration-count: 1; 
    -webkit-animation-name: roll; 
    -webkit-animation-duration: 4s; 
    -webkit-animation-iteration-count: 1; 
} 
14

Como se ha dicho anteriormente, con animaciones CSS3 y transformar.

Wesbo mostró una forma de aplicar el efecto en cualquier sitio. Puede ver una demostración y las instrucciones here.

@-webkit-keyframes roll { 
from { -webkit-transform: rotate(0deg) } 
to { -webkit-transform: rotate(360deg) } 
} 

@-moz-keyframes roll { 
from { -moz-transform: rotate(0deg) } 
to { -moz-transform: rotate(360deg) } 
} 

@keyframes roll { 
from { transform: rotate(0deg) } 
to { transform: rotate(360deg) } 
} 

body { 
-moz-animation-name: roll; 
-moz-animation-duration: 4s; 
-moz-animation-iteration-count: 1; 
-webkit-animation-name: roll; 
-webkit-animation-duration: 4s; 
-webkit-animation-iteration-count: 1; 
} 
+0

css prefijos fueron una idea tan tonta. –

1

Añadir un vínculo con algo así:

javascript:(function(){var s=document.createElement('style');s.innerHTML='%40-moz-keyframes roll { 100%25 { -moz-transform: rotate(360deg); } } %40-o-keyframes roll { 100%25 { -o-transform: rotate(360deg); } } %40-webkit-keyframes roll { 100%25 { -webkit-transform: rotate(360deg); } } body{ -moz-animation-name: roll; -moz-animation-duration: 4s; -moz-animation-iteration-count: 1; -o-animation-name: roll; -o-animation-duration: 4s; -o-animation-iteration-count: 1; -webkit-animation-name: roll; -webkit-animation-duration: 4s; -webkit-animation-iteration-count: 1; }';document.getElementsByTagName('head')[0].appendChild(s);}()); 
0

Este chico va a hacer el truco en cualquier página web:

@-moz-keyframes roll { 
    from { -moz-transform: rotate(0deg) } 
    to { -moz-transform: rotate(360deg) } 
} 
body { 
    -moz-animation-name: roll; 
    -moz-animation-duration: 4s; 
    -moz-animation-iteration-count: 1; 
    } 

recordar que esto es para Firefox.

0

si quieres infinita

@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } 
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } 
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } 
body{-webkit-animation: spin 9.9s infinite linear;} 
Cuestiones relacionadas