FrontEnd/HTML | JS | CSS

๋‰ด๋ชจํ”ผ์ฆ˜ ์Šคํƒ€์ผ๋กœ ์กธ์—…์š”๊ฑด ๊ฒ€์‚ฌ ์‚ฌ์ดํŠธ ์ œ์ž‘ํ•˜๊ธฐ

ddonghyeo 2023. 9. 1. 22:04


๋‚˜๋Š” ์ฃผ๋ณ€์˜ ๋ฌธ์ œ๋“ค์„ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๊ณ ์•ˆํ•˜๊ณ , ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•ด์„œ ๋ฐฐํฌํ•˜๋Š” ๊ฒƒ์„ ๊ฟˆ๊พธ์–ด ์™”๊ณ , ์ด๋ฒˆ ์กธ์—…์š”๊ฑด ์‚ฌ์ดํŠธ๋ฅผ ๋งŒ๋“ค๋ฉด์„œ ๊ทธ ๊ฟˆ์„ ์‹คํ˜„ํ•ด ๋ณด์•˜๋‹ค.

 

 

๊ณ„๊ธฐ

๋™๊ธฐ ํ˜• ์ค‘์— ์กธ์—…์„ ์•ž๋‘๊ณ  ์žˆ๋Š” ํ˜•์ด ์žˆ์—ˆ๋‹ค. ๋‚˜๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ, ์ˆ˜๊ฐ•์‹ ์ฒญ์„ ํ•  ๋•Œ ์ฆˆ์Œ์ด์—ˆ๋‹ค.
3ํ•™๋…„์„ ์•ž๋‘๊ณ  ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—, ์กธ์—…์š”๊ฑด์„ ๋”ฐ์ ธ๊ฐ€๋ฉด์„œ ์–ด๋–ค ๊ณผ๋ชฉ์„ ์ˆ˜๊ฐ•ํ•ด์•ผ ํ•˜๋Š”์ง€ ๊ผผ๊ผผํžˆ ๋”ฐ์ ธ๋ณด๋ฉฐ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์— ๋‹ด์„ ๊ณผ๋ชฉ์„ ๊ณ ๋ฏผํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.

์ฃผ๋ณ€์˜ ๋ฌธ์ œ๋“ค์„ ๋ˆˆ์— ๋ถˆ์„ ์ผœ๊ณ  ์ฐพ๊ณ  ์žˆ์—ˆ๋˜ ๋•Œ๋ผ, ๊ฐœ๋ฐœํ•˜๊ธฐ ๋„ˆ๋ฌด ์ข‹์€ ํƒ€๊ฒŸ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค.

 

 

 

๋ฒค์น˜๋งˆํ‚น

์›น ์‚ฌ์ดํŠธ๋ฅผ ์ œ์ž‘ํ•˜๊ธฐ ์ „์—, ๋จผ์ € ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š” ์‚ฌ์ดํŠธ๋ฅผ ๋‘˜๋Ÿฌ๋ดค๋‹ค.


์„ธ์ข…๋Œ€ํ•™๊ต์˜ ์กธ์—…์š”๊ฑด ๊ฒ€์‚ฌ ์‚ฌ์ดํŠธ์ธ Please Graduate.
์‚ฌ์ดํŠธ๊ฐ€ ์ •๋ง ์ž˜ ๋˜์–ด์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ ๋ฒค์น˜๋งˆํ‚นํ•˜๊ณ  ์›น์‚ฌ์ดํŠธ๋ฅผ ์ œ์ž‘ํ–ˆ๋‹ค.
ํ›„์—๋Š” ์‚ฌ์ดํŠธ ๊ฐœ๋ฐœ์ž์™€ ์ปจํƒ์ด ๋˜์–ด ์†Œ๊ฐœ๋„ ํ–ˆ๋‹ค.

 

 

 

์—ญํ• 

์‚ฌ์‹ค ๋‚˜๋Š” ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ์ž๋ฅผ ๊ฟˆ๊พธ๊ณ  ์ฒ˜์Œ๋ถ€ํ„ฐ ๋ฐฑ์—”๋“œ ์ž‘์—…์„ ํ•˜๊ณ  ์‹ถ์—ˆ๋‹ค.
ํ•˜์ง€๋งŒ ํŒ€์›๋“ค์„ ๋ชจ์œผ๋‹ค ๋ณด๋‹ˆ, ์˜ˆ์ƒ ์™ธ๋กœ ํ”„๋ก ํŠธ ์ž๋ฆฌ๊ฐ€ ๋ถ€์กฑํ–ˆ๋‹ค.
๋งˆ์นจ ๋‚˜๋Š” ์›น์‚ฌ์ดํŠธ ํ”„๋ก ํŠธ ๋ถ€๋ถ„์„ ํ•œ ๋ฒˆ๋„ ํ•ด๋ณด์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์—, ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ์ž์—ฌ๋„ ํ•„์š”ํ•œ ์ง€์‹๋ถ„์•ผ๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค. ์ƒํ™ฉ๋„ ์ด๋Ÿฌํ•œ์ง€๋ผ ํ”„๋ก ํŠธ ์ž‘์—…์„ ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค.

 

 

 

ํ”„๋ก ํŠธ ๊ณต๋ถ€

ํ”„๋ก ํŠธ์— ๋Œ€ํ•œ ์•„์ฃผ ์•„์ฃผ ๊ธฐ์ดˆ๋งŒ ์•Œ๊ณ  ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋” ๊นŠ์€ ๊ณต๋ถ€๊ฐ€ ํ•„์š”ํ–ˆ๋‹ค.
๊ธฐ์ดˆ ๊ฐœ๋…์€ TCP School์„ ์ด์šฉํ–ˆ๋‹ค.
http://www.tcpschool.com/html/intro
์ด์™ธ์—, ๋งˆ์นจ ์ธํ”„๋Ÿฐ์—์„œ css๊ฐ•์˜๊ฐ€ ์„ธ์ผํ•˜๊ธธ๋ž˜ ๊ตฌ์ž…ํ•ด์„œ ๋“ค์–ด๋ณด์•˜๋‹ค.
๊ทธ๋ฆฌ๊ณ  ์—ญ์‹œ ํ•„์š”ํ•œ ๋ถ€๋ถ„์ด ์ƒ๊ธธ ๋•Œ ๋งˆ๋‹ค ๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ํ•ด๋‹ต์„ ์–ป์—ˆ๋‹ค.

 

 

 

 

๋‰ด๋ชจํ”ผ์ฆ˜ ์Šคํƒ€์ผ

๋‚˜๋Š” ์‚ฌ์ดํŠธ์˜ ์ค‘์š”ํ•œ ๋ถ€๋ถ„์ธ ๊ฒ€์‚ฌ ๊ฒฐ๊ณผ ํŽ˜์ด์ง€, ๊ต์–‘ ์ถ”์ฒœ ํŽ˜์ด์ง€๋ฅผ ๋งก์•˜๋‹ค.

๊ต์–‘ ์ถ”์ฒœ ํŽ˜์ด์ง€๋Š” ๋งŒ๋“ค๋‹ค๊ฐ€ ๋ณด๋ฅ˜ํ•ด๋‘์—ˆ๋‹ค.

๋งˆ์นจ ์ง„ํ–‰ํ•˜๋˜ ํ”„๋กœ์ ํŠธ์— ๋””์ž์ด๋„ˆ๋ถ„์ด ๊ณ„์…”์„œ ์กฐ์–ธ์„ ๊ตฌํ•˜๋ฉฐ ๋‰ด๋ชจํ”ผ์ฆ˜ ์Šคํƒ€์ผ๋กœ ๊ฒฐ๊ณผ ํŽ˜์ด์ง€๋ฅผ ๊ตฌ์„ฑํ•ด ๋ณด์•˜๋‹ค.

๋ฐ•์Šค css

.resultbox {
    display: flex;
    flex-direction: column;
    width: 600px;
    height: 300px;
    margin: 45px 35px 20px;
    border-style: solid;
    border-width: 1px;
    border-radius: 20px;
    background: linear-gradient(125deg,#E8EBF2,#F2F3F7);
    border: 1px solid white;
    box-shadow: 10px 15px 30px #dddedf;
    perspective-origin: 50% 50%;
    perspective: 400px;

    /* fade */
    display: inline-block;
    padding: 10px;
    animation: fadein 2s;
    -moz-animation: fadein 2s; /* Firefox */
    -webkit-animation: fadein 2s; /* Safari and Chrome */
    -o-animation: fadein 2s; /* Opera */
}

๋จผ์ € ํ•ญ๋ชฉ๋“ค์„ ์„ธ๋กœ๋กœ ๋‚˜์—ดํ•˜๊ณ , ์› ๊ทธ๋ž˜ํ”„๋ฅผ ํ†ตํ•ด ์–ผ๋งˆ๋‚˜ ์™„๋ฃŒ๋˜์—ˆ๋Š”์ง€ ์ง๊ด€์ ์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋ฐฐ์น˜ํ–ˆ๋‹ค.

display: flex;
flex-direction: column;

๋‘ ์†์„ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ธ๋กœ๋กœ ๋ฐฐ์น˜ํ–ˆ๊ณ , ๋‚ด๋ถ€ ๋ฐ•์Šค์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ •ํ•˜์—ฌ ์™ผ์ชฝ์—์„œ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ์ •๋ ฌ๋˜๊ฒŒ ๋งŒ๋“ค์—ˆ๋‹ค.

border-style: solid;
border-width: 1px;
border-radius: 20px;
background: linear-gradient(125deg,#E8EBF2,#F2F3F7);
border: 1px solid white;
box-shadow: 10px 15px 30px #dddedf;

๋‰ด๋ชจํ”ผ์ฆ˜ ์Šคํƒ€์ผ์„ ์ ์šฉ์‹œํ‚จ ๋ถ€๋ถ„์ด๋‹ค. ์€์€ํ•˜๊ฒŒ ๋– ์žˆ๋Š” ํšจ๊ณผ๋ฅผ ์ฃผ๊ธฐ ์œ„ํ•ด box-shadow์˜ ์œ„์น˜์™€ ํšจ๊ณผ๋ฅผ ์ ์ ˆํ•˜๊ฒŒ ์กฐํ•ฉํ•ด์•ผ ํ•œ๋‹ค.
์ถ”๊ฐ€๋กœ, ์‚ฌ์ดํŠธ์— ๋“ค์–ด์™”์„ ๋•Œ fadeํšจ๊ณผ๋ฅผ ๋„ฃ์–ด์ฃผ์—ˆ๋‹ค.


์•„์ด์ฝ˜์€ fontawesome์˜ ๋ฌด๋ฃŒ ์•„์ด์ฝ˜์„ ์ด์šฉํ–ˆ๋‹ค.

์› ๊ทธ๋ž˜ํ”„

css

/* piechart */
.pie-chart {
    position: relative;
    background-color: #E8EBF2;
    /* display:inline-block; */
    width: 120px;
    height: 120px;
    border-radius: 50%;
    transition: 0.3s;
    margin-left: 15px;
    box-shadow: 1px 1px 6px 4px #cacacc inset;
    display:flex;
    align-items: center;
    justify-content: center;
  }
  .pie-chart-color{
    width: 80%;
    height: 80%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .pie-chart-inner{
    background-color: #E8EBF2;
    width: 83%;
    height: 83%;
    border-radius: 50%;
  }

  span.center{
    background: #E8E9ED;
    /* display : block; */
    position: absolute;
    top:50%; left:50%;
    width:50px; height:50px;
    border-radius: 50%;
    text-align:center; 
    line-height: 50px;
    font-size:13px;
    font-weight: bold;
    color: #0066FF;
    font-weight: bold;
     transform: translate(-50%, -50%);
     box-shadow: 2px 2px 10px 4px #bebec0;
  }

js

//pie-chart
function draw(max, classname, colorname){
  var i=1;
   var func1 = setInterval(function(){
     if(i<max){
         color1(i,classname,colorname);
         i++;
     } else{
       clearInterval(func1);
     }
   },20);
}

function color1(i, classname,colorname){
  $(classname).css({
    "background":"conic-gradient(rgba(0, 102, 255, 0.1) 0%, rgba(0, 102, 255, 1) "+i+"%, rgb(232, 235, 242) "+i+"%, rgb(232, 235, 242) 100%)"
  });
}

์› ๊ทธ๋ž˜ํ”„๋Š” div 3๊ฐœ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋งŒ๋“ค์—ˆ๋‹ค. ๋‰ด๋ชจํ”ผ์ฆ˜ ์Šคํƒ€์ผ์„ ์ง€ํ‚ค๋ฉฐ box-shadow๋ฅผ ๋„ฃ์–ด์ฃผ๊ณ , ์› ์ค‘๊ฐ„์— ํผ์„ผํŠธ๊ฐ€ ๋‚˜ํƒ€๋‚˜๊ฒŒ ์ œ์ž‘ํ–ˆ๋‹ค.
์ถ”๊ฐ€๋กœ js Interval์„ ์ด์šฉํ•˜์—ฌ ๊ทธ๋ž˜ํ”„๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ฐจ์˜ค๋ฅด๋Š” ํšจ๊ณผ๋ฅผ ์—ฐ์ถœํ–ˆ๋‹ค.

์นด์šดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜

$('.count').each(function() { 
    var $this = $(this),
    countTo = $this.attr('data-count');

    $({ countNum: $this.text()}).animate({
        countNum: countTo 
      },
    {
    duration: 1500, // ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์™„๋ฃŒ๋ ๋•Œ๊นŒ์ง€ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„
    easing:'linear', // ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ ๋ฐฉ์‹
    step: function() { // ์›€์ง์ž„ ๊ฐ ์Šคํ…๋ณ„๋กœ ์‹คํ–‰๋  ํ•จ์ˆ˜
    $this.text(Math.floor(this.countNum));
    },
    complete: function() { // ์›€์ง์ž„์ด ๋ฉˆ์ถ˜ ํ›„ ์‹คํ–‰๋  ํ•จ์ˆ˜
    $this.text(this.countNum);
    // this.countNum์ด $this์˜ text๊ฐ’์ด ๋œ๋‹ค
    }
  });  
});

์นด์šดํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ํ†ตํ•ด, ์ˆซ์ž๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์˜ฌ๋ผ๊ฐ€๋Š” ํšจ๊ณผ๋ฅผ ์—ฐ์ถœํ–ˆ๋‹ค.