Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating 'folds' in the plane #41

Closed
grahambates-sp opened this issue May 23, 2020 · 4 comments
Closed

Creating 'folds' in the plane #41

grahambates-sp opened this issue May 23, 2020 · 4 comments
Labels
seeking advice Not a bug but looking for advices on how to use the library to achieve something

Comments

@grahambates-sp
Copy link

I am trying to achieve this effect on a google map style canvas:

https://sachabarbs.wordpress.com/2014/09/11/paper-effect-google-maps/

As someone who is not so experienced in webGL, can anyone give me any pointers as to whether curtains js is a suitable tool for this, and any pointers as to the approach?

@23d1
Copy link

23d1 commented May 23, 2020

You could probably achieve it with shaders, but the purpose of Curtains is to apply effects to multiple elements on a page. If you need finer control, you might be better off using something else. I could be wrong, but that's my take.

@martinlaxenaire
Copy link
Owner

Hi @grahambates-sp,

As @23d1 said implementing a fold effect on a plane should be pretty straigthforward. You'd have to update the vertices Z positions based on their X positions using a mod() function in your vertex shader for example.

However as far as I know, embedded google maps only work within iframes and you won't be able to you use that as a plane texture. You could use a jpg of that map, but then you'll lose the ability to interact with the map.

To sum up: the fold effect is definitely doable but I don't think there's any way to use a google map as a plane texture.

Hope I've been helpful there.

Cheers,

@grahambates-sp
Copy link
Author

Luckily its not google maps I am going to use - it will be one of ESRI or Deckgl canvas based libraries.

@martinlaxenaire
Copy link
Owner

Well then, if you're map is rendered in a canvas (preferably offscreen), then you should be able to use it as a plane texture.

Two things that comes to my mind however:

  • You might have some trouble computing the right mouse coordinates on the map since you're gonna displace the vertices of the plane.
  • With 2 separate webgl contexts and a canvas texture that will need to be constantly updated, I won't be surprised if you encounter some performance issues.

@martinlaxenaire martinlaxenaire added the seeking advice Not a bug but looking for advices on how to use the library to achieve something label Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
seeking advice Not a bug but looking for advices on how to use the library to achieve something
Projects
None yet
Development

No branches or pull requests

3 participants