jdw2 Posted April 19, 2020 Share Posted April 19, 2020 Does Greensock have any methods akin to the following in either it's core or in any of the plugins as I am currently having to use Snap svg and would rather not have to rely on additional libraries. Basically these methods in Snap allow you to identify the intersections between two paths even if they have been transformed. var domesticIntersection = Snap.path.intersection(domesticSupplyPath,worldSupplyPath); let matrixStuff = d3.select(".demand").node().transform.baseVal.consolidate().matrix; let matrixObject = Snap.matrix(matrixStuff); let pathString = Snap.path.map(demandPath,matrixObject); Link to comment Share on other sites More sharing options...
PointC Posted April 19, 2020 Share Posted April 19, 2020 Hi @jdw2 Welcome to the forum and thanks for joining Club GreenSock/ I'm not familiar with Snap, but GSAP does have hitTest(). https://greensock.com/docs/v3/Plugins/Draggable/static.hitTest() We've also had numerous threads about collision detection which may be helpful. Just do a quick search and several should pop up for you. Happy tweening and welcome aboard. Link to comment Share on other sites More sharing options...
OSUblake Posted April 19, 2020 Share Posted April 19, 2020 5 hours ago, jdw2 said: Does Greensock have any methods akin to the following in either it's core or in any of the plugins No. There's not a lot of libraries that can do that. 5 hours ago, jdw2 said: would rather not have to rely on additional libraries You don't need d3 for the code you provided. consolidate is a native method. https://developer.mozilla.org/en-US/docs/Web/API/SVGTransformList 1 Link to comment Share on other sites More sharing options...
Shrug ¯\_(ツ)_/¯ Posted April 20, 2020 Share Posted April 20, 2020 Just for fun and with smaller footprints than snap, here are some interesting ones I can think of. Kevin Lindsey did some neat stuff with his Intersection.js library http://www.kevlindev.com/geometry/2D/intersections/index.htm And the following was also based upon Kevin’s work https://github.com/signavio/svg-intersections . This page http://svg-polygon.com/ by fhemsher (Francis Hemsher) has some interesting collision / intersection examples also. There also used to be a site called ‘svgdiscovery .com’ by him with tons of cool SVG stuff. You can also find many great SVG posts by him on StackOverflow. But sadly in looking just now, it appears he passed away in March 2020. 😞 3 Link to comment Share on other sites More sharing options...
OSUblake Posted April 20, 2020 Share Posted April 20, 2020 4 minutes ago, Shrug ¯\_(ツ)_/¯ said: Kevin Lindsey did some neat stuff with his Intersection.js library http://www.kevlindev.com/geometry/2D/intersections/index.htm Oh wow! That site sure is familiar. Spent like a year deconstructing all his work. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now