Jump to content
Search Community

MotionPath for Image - Responsive Motion Path Diagonally Across Viewport

charlie_sage test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hi there, I am fairly new to greensock and wd in general. After watching all the videos and reading through the documentation, I still cannot figure out why this code is not working properly. 

What I am trying to do: 

Utilize the MotionPath plugin to get an image to move from the bottom/left,  -> top/right of the screen where it either disappears or fades out and stays hidden unless it's moving across the screen. Once I get that in, I will be adding a timeline where the plane appears to drag another image across the screen along the same path and from there some text will be revealed via tween.to, which I think I can make work once this issue is resolved. 

Issue:  

I can't seem to get the initial image/plane to move along the path (or move at all)that I need or make it responsive. The path that is in the svg now is a place holder that I was going to edit once I got the plane moving.  I have tried placing the img both inside and outside the svg, along with everything else I could think of. The codepen is attached if someone can take a look. 

 

If anyone could assist, I would appreciate it so much.

 

See the Pen by pen?template=oNpmmNm (@pen?template=oNpmmNm) on CodePen

Link to comment
Share on other sites

  • Solution

Hello @charlie_sage

 

Welcome to the GreenSock forums and the wonderful world of web development 🙃

 

The path data in your HTML is not within quotation marks and it needs the d attribute to be recognized as path data.

 

// bad
<path id="path" fill="none" M8,102 C15,83 58,25 131,24 206,24 233,63 259,91 292,125 328,155 377,155 464,155 497,97 504,74 />
  
  
// good
<path id="path" fill="none" d="M8,102 C15,83 58,25 131,24 206,24 233,63 259,91 292,125 328,155 377,155 464,155 497,97 504,74" />

 

 

 

Also, here I set the alignto the path too, and set an alignOrigin instead of the initial transforms you set beforehand. Works better now :)

 

See the Pen KKZJLzq?editors=1010 by akapowl (@akapowl) on CodePen

 

  • Like 4
Link to comment
Share on other sites

It should be editable in my pen. I added pointer-events: none in the CSS there to the .container, as it is sitting on top of the SVG (z-axis wise) and thus is blocking it.

 

I'm not at my desk for a while, so I won't be able to help more than that. Hope it will help though.

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...