2023 학원 수업 일지

수업 26일차 - html/css/javascript 4

웨일파도 2023. 4. 10. 11:28
반응형

1교시 : 트랜지션

transform: scale

      #scalex:hover{
        transform: scaleX(2);  /* x축으로(가로) 2배 확대 */ 
      }
      #scaley:hover{
        transform: scaleY(1.5);  /* y축으로(세로) 1.5배 확대 */ 
      } 
      #scale:hover{
        transform: scale(0.7);  /* x, y축으로(가로, 세로) 0.7배 확대 */ 
      }

transform:skew

        #scalex:hover {
            transform: skewX(50deg); /* 50도 만큼 X축으로 비틀어짐 */
        }    
        #scaley:hover {
            transform: skewY(20deg); /* 20도 만큼 Y축으로 비틀어짐 */
        }
        #scale:hover{
            transform: skew(15deg, 15deg); /* 15도 만큼 X,Y축으로 비틀어짐 */
        }

transform: translate

        #scalex:hover {
            transform: translateX(50px); /* 50px X축으로 이동  */
        }    
        #scaley:hover {
            transform: translateY(-30px); /* 30px 만큼 Y축으로 이동 */
        }
        #scale:hover{
            transform: translate(-20px, 10px); /* -20px, 10px x ,y축으로 이동 */
        }

transform: rotate

        #scalex:hover {
            transform: rotate(40deg); /* 40도 만큼 돌리기  */
        }

 

transition-property, transition-duration

           -- transition-property: width height;
           -- transition-duration: 2s;

       .box {
            margin: 20px auto;
            width: 100px;
            height: 100px;
            background-color: aquamarine;
            border: 1px solid #ccc;
            transition:3s linear;
        }
        /* linear 일정한 속도 */
        /* ease 천천히 -> 빠름 -> 천천히 속도 */
        /* ease-in 천천히 -> 보통 속도 */
        /* ease-out 보통 -> 천천히 속도 */
        /* ease-in-out 천천히 -> 보통 -> 천천히 속도 */
        
        .box:hover{
            width: 200px;
            height: 200px;
            background-color: bisque;
            transform: rotate(270deg);
        }

 

<!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.0">
    <title>Document</title>
    <style>
        .org {
            width:150px;
            height: 180px;
            border:1px solid black;
            margin:30px;
            float:left;
        }
        .org > div {
            width:150px;
            height: 180px;
        }
        .rotetex:hover{
            transform: rotateX(50deg);
        }
        #per {
            perspective: 300px;
        }
    </style>
</head>

<body>
    <div class="org">
        <img src="../images/sunset.jpg">
    </div>
    <div class="org">
        <div class="rotetex">
            <img src="../images/sunset.jpg">
        </div>
    </div>
    <div class="org" id="per">
        <div  class="rotetex" >
            <img src="../images/sunset.jpg">
        </div>
    </div>
</body>
</html>

2교시

 

Transform:scale
<!DOCTYPE html>
<html lang="ko">
	<head>
		<meta charset="UTF-8">
		<title>Transform:scale</title>
    <style>
			#container{
				width:600px;
				margin:20px auto;
			}
			.origin {
				width: 100px;
				height: 100px;
				border: 1px solid black;
				float: left;
				margin: 40px;
			}
			.origin > div {				
				width:100px;
				height:100px;
				background-color:orange;
			}
    
        #rotateX:hover {
            transform: rotate(40deg); 
        }  
		
		#rotateY:hover {
			transition-duration: 2s;
			transform: rotateY(45deg);
		}

		#per {
			perspective: 150px;
		}

		#rotateZ:hover {
			transform: rotateZ(45deg);
		}

		#rotate:hover {
			transform: rotate3d(1,1,1,50deg)
		}
		</style>
	</head>
	<body>
		<div id="container">		
			<div class="origin">
				<div id="rotateX"></div>
			</div>

			<div class="origin" id="per">
				<div id="rotateY"></div>
			</div>

			<div class="origin" id="per">
				<div id="rotateZ"></div>
			</div>

			<div class="origin" id="per">
				<div id="rotate"></div>
			</div>

		</div>		
	</body>
</html>
Document
<!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.0">
    <title>Document</title>
    <style>
        #container {
            width: 500px;
            margin:0 auto;
        }
        .box {
            width: 200px;
            height: 200px;
            float:left;
            margin:30px;
        }
        #box1 {
            background-color: aquamarine;
            border: 1px solid transparent;
            animation-name: shape;
            animation-duration: 3s;
            animation-iteration-count: infinite;
        }
        #box2 {
            background-color: pink;
            border: 1px solid transparent;
            animation-name: rotate;
            animation-duration: 3s;
            animation-iteration-count: infinite;
        }
        @keyframes shape {
            from {
                border : 1px solid transparent
            }
            to {
                border:1px solid black;
                border-radius: 50%;
            }
        }
        @keyframes rotate {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(90deg);
            }
        }
    </style>
</head>
<body>
    <div class="box" id="box1"></div>
    <div class="box" id="box2"></div>

</body>
</html>
Document
<!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.0">
    <title>Document</title>
    <style>
        #container {
            width: 500px;
            margin:0 auto;
        }
        .box {
            width: 200px;
            height: 200px;
            float:left;
            margin:30px;
            animation: rotate 2s infinite, blck 2s infinite alternate;
        }
       
        @keyframes rotate {
            from {transform: perspective(120px) rotateX(0deg) rotateY(0deg);}
            50% {transform: perspective(120px) rotateX(180deg) rotateY(0deg);}
            to {transform: perspective(120px) rotateX(180deg) rotateY(180deg);}
        }

        @keyframes blck {
            from {background-color: red;}
            50% {background-color: yellow;}
            to {background-color: green;}
        }
      
    </style>
</head>
<body>
    <div class="box"></div>
    <div class="box"></div>

</body>
</html>
Transition timing function
ease
linear
ease-in
ease-out
ease-in-out
<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <title>Transition timing function</title>
  <style>
    #ex div{
      float:left;
      width:100px;
      height:50px;
      margin:5px 10px;
      padding:5px;
      color:white;
      background-color:#006aff;
      border-radius:5px;
      text-align:center;
      font-weight:bold;	
    }
    #ex:hover div{
      height:400px;
    }
    .ease { transition: 3s ease;} /* ease 천천히 -> 빠름 -> 천천히 속도 */
    .linear { transition: 3s linear;}  /* linear 일정한 속도 */
    .ease-in { transition: 3s ease-in;}  /* ease-in 천천히 -> 보통 속도 */
    .ease-out { transition: 3s ease-out;}  /* ease-out 보통 -> 천천히 속도 */
    .ease-in-out {transition: 3s ease-in-out; }   /* ease-in-out 천천히 -> 보통 -> 천천히 속도 */
    
  </style>
</head>

<body>
  <div id="ex">
    <div class="ease"> ease </div>
    <div class="linear"> linear </div>
    <div class="ease-in"> ease-in </div>
    <div class="ease-out"> ease-out </div>
    <div class="ease-in-out"> ease-in-out </div>
  </div>
</body>
</html>

3교시

4교시

 

7교시 

display : flex

            display:flex;
            flex-direction:column;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            align-self: flex-start;

 

반응형