Jump to content
Search Community

Drawing border around square from the middle of the bottom

Leftfield test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

HI All, I am quite new at this, please help.

I want to draw a border from the bottom of square, so it goes from the half of the square simultaneously to the left and right side, joining at the top.
To be more clear: In the middle of the bottom lines starts - two lines going to the left and right side, joining at the top middle.

Sorry fox, after few hours of trying, I am getting funny results but not even close.

Link to comment
Share on other sites

Welcome to the forums, @Leftfield

 

You'd need to adjust your SVG artwork so that the rectangle is a <path> that's has its origin in the top center (or use two <path> elements, one for each side of the rectangle). Do you have a demo we can peek at? Perhaps a codepen? It'd really help to see our artwork so that we can deliver the proper <path> data. 

  • Like 1
Link to comment
Share on other sites

It would definitely help to start a new topic, yes. 

 

I'm not sure what you mean by "doesn't work". Are you getting a specific error? Are you getting redirected somewhere? Are you trying to use the codepen-specific DrawSVGPlugin file locally? If so, that won't work; DrawSVGPlugin is a membership benefit of Club GreenSock. When you join, you can download a zip with files that can be run ANYWHERE (no restrictions whatsoever). The demos we do on codepen use a special version of the plugin that only works with that domain (codepen.io). Does that answer your question? 

  • Like 2
Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...
  • 8 months later...
  • 1 year later...
  • 1 year later...

I am kindda new to SVG stroke animations and I was hoping that this particular animation can be customized via JS to start from a little to the right of the bottom left corner of the square (see pointed location in the image below).

 

I was hoping that that can be done simply via changing the "50% 50%" part of the drawSVG: "50% 50%". I've tried to modify the values in this CodePen but I'm not sure I understand how the drawSVG percentages work:

See the Pen bGLgoPO by fuad-zeyad-tareq (@fuad-zeyad-tareq) on CodePen

 

To be clear, I'd still like the exact same animation (i.e. the borders are drawn from both directions of the origin point), just that the origin point be in a different location. Am I wrong in assuming that it can be done via the drawSVG percentages?

firefox_JiEJB2lKDJ.png

Link to comment
Share on other sites

Is something like this what you are looking for? I used a `.fromTo()` animation to animate from and to a specific points on the path.

 

The whole line is 100%, so you can play with the starter position by using numbers between 0% and 100%. In this demo I moved the end position to the top right position by using a higher value then 100% 

 

 

See the Pen oNEBpBV?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...