Help us understand the problem. What is going on with this article?

CSS3 Animationで1日の流れを再現してみた

More than 3 years have passed since last update.

今回作ったのは
スクリーンショット 2015-07-31 15.50.29.png

スクリーンショット 2015-07-31 15.55.32.png

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="index.css">
  <title>Document</title>
</head>
<body>
<div id="world">
  <div id="day">
    <div id="sun"></div>
    <div id="moon"></div>
  </div>
  <div id="way"></div>
  <div id="car">
    <div class="parts" id="head"></div>
    <div class="parts" id="body"></div>
    <div class="parts" id="tire"></div>
  </div>
</div>
</body>
</html>

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,body{
  height: 100%;
}

#world{
  height: 100%;
  display: flex;
  flex-flow: column-reverse;
  overflow: hidden;
  animation: bgColor 24s infinite linear;
}

#day{
  animation: time 24s infinite linear;
}

#sun{
  position: fixed;
  top: 80px;
  left: -80px;
  width: 100px;
  height: 100px;
  border-radius: 100%;
  background: orange;
}

#moon{
  position: fixed;
  bottom: -80px;
  right: -100px;
  width: 100px;
  height: 100px;
  border-radius: 100%;
  background: yellow;
}

#way{
  width: 100%;
  height: 70px;
  background: #696969;
}

#car{
  position: relative;
  bottom: 18px;
  left: -30px;
  display: flex;
  flex-flow: row-reverse;
  justify-content: flex-end;
  align-items: baseline;
  animation: drive 24s infinite linear;
}

#car #head{
  width: 80px;
  height: 60px;
  border-radius: 10% 50% 0 0;
  background: blue;
}

#car #body{
  width: 300px;
  height: 65px;
  background: green;
}

#car #tire{
  position: relative;
  bottom: -20px;
  left: 40px;
  width: 35px;
  height: 35px;
  border-radius: 100%;
  background: black;
  box-shadow:
     36px 0 0 0 black,
    335px 0 0 0 black;
}

@keyframes drive{
  from{
    transform: translateX(0px);
  }

  to{
    transform: translateX(100%);
  }
}

@keyframes time{
  from{
    transform: rotate(0deg);
  }

  to{
    transform: rotate(360deg);
  }
}

@keyframes bgColor{
  0%{
    background: #90D7EC;
  }

  90%{
    background: #001E43;
  }

  100%{
    background: #90D7EC;
  }
}

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした