Comments (18)
Usually, you should not use the curlView while the user can still interact with your view and its contents. While curling, the content should usually be static, because it takes a lot of time to render the view onto a texture, and so it will make your app really slow if you attempt to do that several times per second. Therefore, only apply the curl when necessary.
from xbpagecurl.
I understand that it takes a lot of time. That's why I'm looking for a non-textured version (with transparent background), so it would render only during curl animation. This way I won't need to update the render every time the curled view updated and it won't affect the performance.
Thanks
from xbpagecurl.
But the curled view needs to be drawn on an OpenGL triangle mesh.
from xbpagecurl.
The thing I want to make has already been made by Apple in their Maps app. By default, they have a small curled corner in the bottom right part of the screen. And because the front view can be scrolled by user (while curved corner is still there) they do not distort the texture of it: http://i.imgur.com/cKWsi.jpg (they also do not render half-transperent texture on the back side of the corner)
Perhaps, they just use a picture for an idle state of the corner (instead of real rendering), but I need this small corner to curl/uncurl with animation, so I can't use an image.
from xbpagecurl.
Look into the Page Curl Sample. You can do that using the XBPageDragView. You have to add that curled corner image yourself as a subview of it.
from xbpagecurl.
I think you got me wrong. I need the curled corner to be like on the picture (without distorting front view). And I can't use a static picture for the curled corner, because I need it to appear with animation. Here another picture:
http://i.imgur.com/wCm94.jpg
Hope it helps.
Thanks.
from xbpagecurl.
So the little corner won't be curled all the time… In this case you could do the little curl animation using XBPageCurl and right after replace the corner with a XBPageDragView containing an image in it.
from xbpagecurl.
I thought about this. The problem is the curled corner may appear while user is scrolling. So the curled area will have a different part of the view as a texture.
from xbpagecurl.
The curled corner will just be an image while the user scrolls. If he touches and drags it the XBCurlView will be added over it and will start to animate the curl.
from xbpagecurl.
By default, when user scrolls there's NO curled corner at all (I showed it on the pic above). Then at some time curled corner appears with animation. But the user may be in the proccess of scrolling when the animation runs. So this way curled corner will have an outdated texture.
from xbpagecurl.
If you look in the maps app you will notice that the texture/image of the static curled corner does not change, it is a fixed image.
from xbpagecurl.
I know. That's why I need this "light mode" for XBPageCurl - so I could use it instead of a static image.
from xbpagecurl.
This would require several renderInContext: and glTexImage2D calls per second and would slowdown your app for a very subtle effect. You'd better use an static image instead.
from xbpagecurl.
So, is it impossible to just make alpha=0 (for example) for the front texture? It would be transparent and user would see the actual view instead. This way there's no need to make texture from a view at all.
It would look kinda like this:
http://i.imgur.com/1KNlP.png
GREEN is where pagecurl should be transparent
from xbpagecurl.
You can do that with an image with transparency. Only start the curlView if the user drags on there, which is what XBPageDragView does.
from xbpagecurl.
Sorry, I already explained that I can't use image for this. I need this transparency when the curled corner appears with animation like in the image I showed above: http://i.imgur.com/wCm94.jpg
Also, let's forget about dragging right now. It's not the issue.
Thanks
from xbpagecurl.
I don't think that is really possible right now. Anyway, as I said earlier you can achieve an approximate result using an image with transparency. I still can't see a possibility to implement that into XBPagelCurl, I mean dynamic page content, because it's just not cheap to keep updating the texture all the time.
from xbpagecurl.
I found kind of solution for this by making front fragment shader transparent:
In FrontFragmentShader.glsl:
void main() { vec4 color = texture2D(s_tex, v_texCoord); vec3 n = normalize(v_normal); float alpha = 1.0 - n.z; // using n.z (shading value) that we already have there to determinate which pixels should be transparent gl_FragColor = vec4 (0, 0, 0, alpha); }
Then, set myCurledView.userInteractionEnabled = NO;
so that the view that has 'curled' became interactive (not the curled corner itself).
The only few problems here.
First, because now the front layer (curled view that replaces an original interactive view in the original code) is missing, there's should always be a texture for "next page" - [myCurledView drawViewOnNextPage:backgroundView];
Second, the texture for the front page is still being generated and it's not used by the shader.
from xbpagecurl.
Related Issues (20)
- Weird behavior of the example project HOT 3
- tap to uncurl
- Curl -- corner doesn't always pick up HOT 4
- some bug
- XBPageCurl curling acting weird
- another gpus_ReturnNotPermittedKillClient crash HOT 2
- How to implement pages flipping like iBook? HOT 1
- Page Flipping in Two Page Book HOT 1
- Source differences between Git and Cocoapods HOT 1
- duplicate symbol _XBAnimationInterpolatorEaseInOut HOT 3
- updating the frame of the curlView for the next page HOT 2
- Calling drawImageOnNextPage: not working
- Unable to use this library in Swift.
- OpenGL Error 501 in console logs
- EXC_BAD_ACCESS in applicationWillResignActiveNotification
- curl animation don't work very well on IPhone 6 HOT 1
- curl effect render hide and show
- won't compile cleanly. Needed: In XBAnimation.h, the 4 blocks need to be marked extern
- https://github.com/bachelora/iOS-PageCurl-OpenGL
- Unable to integrate this onto the Swift project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xbpagecurl.