Created
April 26, 2025 20:37
-
-
Save 0xbageltoes/322a7478f9849652574a671fb558cf77 to your computer and use it in GitHub Desktop.
SVG - gradient draw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="dkl-graphic-firstlook graphic-l"> | |
| <svg fill="none" viewBox="0 0 250 400" class="graphic-l"> | |
| <path d="M 250,0 0,80 0,400" stroke="gray" stroke-width="2" stroke-opacity="0.2" stroke-linecap="round"></path> | |
| <path d="M 250,0 0,80 0,400" stroke-width="2" stroke="url(#gradient-l)" stroke-opacity="1" stroke-linecap="round"></path> | |
| <defs> | |
| <linearGradient class="gradient-l" id="gradient-l" gradientUnits="userSpaceOnUse" x1="100%" x2="80%" y1="-20%" y2="0%"> | |
| <stop offset="0%" stop-color="#ffafaf" stop-opacity="0"></stop> | |
| <stop offset="15%"stop-color="#ffd2d1"></stop> | |
| <stop offset="30%" stop-color="#b17e7e"></stop> | |
| <stop offset="60%" stop-color="#771212" stop-opacity="0"></stop> | |
| </linearGradient> | |
| </defs> | |
| </svg> | |
| </div> | |
| <div class="dkl-graphic-firstlook graphic-r"> | |
| <svg fill="none" viewBox="0 0 250 400" class="graphic-r"> | |
| <path d="M 0,0 250,80 250,400" stroke="gray" stroke-width="2" stroke-opacity="0.2" stroke-linecap="round"></path> | |
| <path d="M 0,0 250,80 250,400" stroke-width="2" stroke="url(#gradient-r)" stroke-opacity="1" stroke-linecap="round"></path> | |
| <defs> | |
| <linearGradient class="gradient-r" id="gradient-r" gradientUnits="userSpaceOnUse" x1="-20%" x2="0%" y1="-20%" y2="0%"> | |
| <stop offset="0%" stop-color="#ff8709" stop-opacity="0"></stop> | |
| <stop offset="30%"stop-color="#ff8709"></stop> | |
| <stop offset="70%" stop-color="#f7bdf8"></stop> | |
| <stop offset="100%" stop-color="#f7bdf8" stop-opacity="0"></stop> | |
| </linearGradient> | |
| </defs> | |
| </svg> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gsap.to(".gradient-r", { | |
| attr: { x1: "100%", x2: "120%", y1: "100%", y2: "120%" }, | |
| repeat: -1, | |
| duration: 2.5, | |
| ease: "sine.inOut" | |
| }); | |
| gsap.to(".gradient-l", { | |
| attr: { x1: "0%", x2: "20%", y1: "100%", y2: "120%" }, | |
| repeat: -1, | |
| duration: 2.5, | |
| ease: "sine.inOut" | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://unpkg.com/gsap@3/dist/gsap.min.js"></script> | |
| <script src="https://assets.codepen.io/16327/DrawSVGPlugin3.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| margin:0; | |
| padding:0; | |
| width:100%; | |
| height:100vh; | |
| display:flex; | |
| align-items:center; | |
| justify-content:center; | |
| background: #fafafa; | |
| overflow: hidden; | |
| } | |
| /* | |
| .container { | |
| position: relative; | |
| width: 90vw; | |
| height: 90vh; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: space-evenly; | |
| border-radius: 9px; | |
| } */ | |
| #svg-stage { | |
| width:100%; | |
| max-width:100vw; | |
| overflow:visible; | |
| } | |
| .dkl-graphic-firstlook { | |
| display: flex; | |
| width: fit-content; | |
| height: auto; | |
| max-width: 600px; | |
| max-height: 600px; | |
| border: 1px dashed green; | |
| } | |
| .dkl-graphic-firstlook svg { | |
| width: 100%; | |
| height: auto; | |
| max-height: 80%; | |
| } | |
| .graphic-l { | |
| padding-left: 10px; | |
| } | |
| .graphic-r { | |
| padding-right: 10px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment