2016-11-15 8 views
1

移動したときにトランジションプロパティが元に戻ったアニメーションを再生しないのはなぜですか?アニメーションが表示されていないときにアニメーションを元に戻すのはなぜですか?

transformを取り消すと、元のアニメーションに戻ってしまいます。

body { 
 
    background-color : #333333; 
 
} 
 

 
.corner { 
 
    background-color   : rgb(207, 207, 207); 
 
    border-bottom-right-radius: 100%; 
 
    height     : 50px; 
 
    left      : 0px; 
 
    position     : fixed; 
 
    top      : 0px; 
 
    width      : 50px; 
 
} 
 

 
.corner:hover { 
 
    transform : rotateX(180deg) rotateY(180deg) rotateZ(180deg); 
 
    transition: all .5s ease-in-out; 
 
} 
 

 
#top-right { 
 
    left  :auto; 
 
    right : 0px; 
 
    top  : 0px; 
 
    transform: rotate(90deg); 
 
} 
 

 
#bottom-left { 
 
    bottom :0; 
 
    left  :0px; 
 
    right : auto; 
 
    top  : auto; 
 
    transform: rotate(-90deg); 
 
} 
 

 
#bottom-right { 
 
    bottom :0px; 
 
    left  :auto; 
 
    right : 0px; 
 
    top  : auto; 
 
    transform: rotate(180deg); 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>Rentats Royo</title> 
 
    <link rel="stylesheet" href="css/styles.css"> 
 
    <style type="text/css"> 
 
    </style> 
 
</head> 
 
<body> 
 
    <div class="corner"></div> 
 
    <div class="corner" id="top-right"></div> 
 
    <div class="corner" id="bottom-left"></div> 
 
    <div class="corner" id="bottom-right"></div> 
 
</body> 
 
</html>

+0

!ありがとう、あなたは私をたくさん助けました。 –

答えて

0

問題がtransitionプロパティが:hover擬似クラスで定義されている代わりの要素の通常の状態で宣言されていることです。

詳細はpostをお読みください。あなたはリッキーポイントを持っている@Ricky_Ruiz

body { 
 
    background-color : #333333; 
 
} 
 

 
.corner { 
 
    background-color   : rgb(207, 207, 207); 
 
    border-bottom-right-radius: 100%; 
 
    height     : 50px; 
 
    left      : 0px; 
 
    position     : fixed; 
 
    top      : 0px; 
 
    width      : 50px; 
 
    transition    : all .5s ease-in-out; 
 
} 
 

 
.corner:hover { 
 
    transform : rotateX(180deg) rotateY(180deg) rotateZ(180deg); 
 
} 
 

 
#top-right { 
 
    left  :auto; 
 
    right : 0px; 
 
    top  : 0px; 
 
    transform: rotate(90deg); 
 
} 
 

 
#bottom-left { 
 
    bottom :0; 
 
    left  :0px; 
 
    right : auto; 
 
    top  : auto; 
 
    transform: rotate(-90deg); 
 
} 
 

 
#bottom-right { 
 
    bottom :0px; 
 
    left  :auto; 
 
    right : 0px; 
 
    top  : auto; 
 
    transform: rotate(180deg); 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>Rentats Royo</title> 
 
    <link rel="stylesheet" href="css/styles.css"> 
 
    <style type="text/css"> 
 
    </style> 
 
</head> 
 

 
<body> 
 
    <div class="corner"></div> 
 
    <div class="corner" id="top-right"></div> 
 
    <div class="corner" id="bottom-left"></div> 
 
    <div class="corner" id="bottom-right"></div> 
 
</body> 
 

 
</html>

+0

あなたはちょうどポイントがあります、あなたが応答しないのは残念です、あなたは素晴らしいです。 –

+0

いつでも ':-)'、あなたも素晴らしい相手です! – Ricky

関連する問題