½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
happycgi
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > CSS > ¹öư > Squircle Web Component Button »ó¼¼Á¤º¸
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
javascript
PHP
CSS
html
ASP
API
jquery
mysql
image
Mobile
slide
°Ô½ÃÆÇ
¸Þ´º
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
Squircle Web Component Button
¼Ò½ºÅë°èÁ¤º¸ ¿À·ù½Å°í ¹× ¹®ÀÇ
ÇØÇÇÆÀ
³×ƼÁð
Æ®À§ÅÍ·Î º¸³»±â ÆäÀ̽ººÏÀ¸·Î º¸³»±â
¼Ò½ººÐ·ù ¹öư
´Ù¿î·Îµå Ƚ¼ö 0 ȸ
°£´Ü¼³¸í À¥ ¹öư µðÀÚÀÎ ÀÔ´Ï´Ù.
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
ȨÆäÀÌÁö¹Ù·Î°¡±â ¼Ò½º´Ù¿î·Îµå µ¥¸ð ¹Ì¸®º¸±â ½ºÅ©·¦Çϱâ
¹öư µðÀÚÀÎÀ¸·Î ¸¶¿ì½º ¿À¹ö ½Ã ¹öư ¹è°æÀÌ ¹Ù²î´Â ¾Ö´Ï¸ÞÀ̼ÇÀÌ ÀÖ½À´Ï´Ù.
HTML, CSS, JS·Î Á¦À۵Ǿú½À´Ï´Ù.
ÀÚ¼¼ÇÑ ³»¿ëÀº µ¥¸ð¸¦ È®ÀÎÇØ Áֽñ⠹ٶø´Ï´Ù.



 

HTML
<sq-button onclick="alert('Yay!')">
  Squircle
</sq-button>
 
<sq-button onclick="alert('The long and the short of it')">
  Long Squircle Button
</sq-button>
 
<sq-button onclick="alert('Saved!')">
  OK
</sq-button>

CSS
body {
  height: 100svh;
  display: grid;
  place-items: center;
  background: #faffec;
}
 
@property --bg-rotate {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

 
JS
// technique pulled from:
// https://www.simeongriggs.dev/responsive-extendable-squircles-with-svg-and-css
 
customElements.define("sq-button", class extends HTMLElement {
  constructor() {
    super()
    this.attachShadow({ mode: "open" })
  }
 
  connectedCallback() {
    const styles = `
      :host {
        --drop-shadow: 0 4px 15px rgb(220, 80, 40, 0.6);
        --animation-duration: 0.2s;
        --bg-gradient: #fc3 5%, #41b 95%;
 
        display: inline-block;
        filter: drop-shadow(var(--drop-shadow));
        transition: all var(--animation-duration) ease-in-out;
      }
 
      /* This effect is cool, but unfortunately has graphical glitches in Safari */
      /* :host(:hover) {
        scale: 105%;
        rotate: -1deg;
      } */
 
      svg {
        position: absolute;
        height: 0px;
        width: 0px;
        margin-left: -999px;
      }
 
      button {
        --bg-rotate: 135deg;
 
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        appearance: none;
        font-size: 1.5rem;
        font-family: system-ui;
        font-weight: bold;
        border: 0;
        margin: 0;
        padding: .85em 1.15em;
        line-height: 1;
        color: white;
        clip-path: url(#squircleClip);
        background-image: linear-gradient(var(--bg-rotate) in oklch, var(--bg-gradient));
        transition: --bg-rotate var(--animation-duration) ease-in-out;
      }
 
      button:hover {
        --bg-rotate: 315deg;
      }
    `
 
    this.shadowRoot.innerHTML = `
      <style>${styles}</style>
      <button><slot></slot></button>
      <svg>
        <clipPath id="squircleClip" clipPathUnits="objectBoundingBox">
          <path d="M 0,0.5
                   C 0,0  0,0  0.5,0
                     1,0  1,0  1,0.5
                     1,1  1,1  0.5,1
                     0,1  0,1  0,0.5"
          />
        </clipPath>
      </svg>
    `
    // more rounded d: M 0 0.5 C 0 0.1 0 0 0.5 0 S 1 0.1 1 0.5 S 1 1 0.5 1 S 0 0.9 0 0.5
  }
})

 


³×ƼÁð ÀÇ°ß   ÀÌ¿ëÇϽŠÀÚ·áÀÇ Èı⸦ ÀÚÀ¯·Ó°Ô ÀÛ¼ºÇϼ¼¿ä. (»ó¾÷ÀûÀÎ ±¤°í ¹× µµ¹è¼º ±Û µîÀº »çÀüÅ뺸¾øÀÌ »èÁ¦µÉ ¼ö ÀÖ½À´Ï´Ù.)
³»¿ë ¾ÆÀ̵ð Àǰ߳²±â±â
µî·ÏµÈ ÀǰßÀÌ ¾ø½À´Ï´Ù.
1
À̸§
³»¿ë
:³×¸Â¾Æ¿ä: :È­³ª´Â±º¿ä: :Àá¿Í: :¿ì¿ïÇØ: :À̰ǾƳÄ: :¿ÕÇÏÇÏ: ¿Õ¿ôÀ½~ ³î·¥~
Æò°¡Çϱâ ÈǸ¢ÇÔ ¸Å¿ìÁÁÀ½ ÁÁÀ½ ±¦ÂúÀ½ º¸Åë º°·Î
µµ¹è¹æÁöŰ
 76766945 º¸ÀÌ´Â µµ¹è¹æÁö۸¦ ÀÔ·ÂÇϼ¼¿ä.