Did you ever seen Material Design? Android had a good design language. The iOS Guidelines are a joke compared to that.
But I don’t want to argue with you…
PS: Quality is the best joke I’ve heard about Apple the last weeks - “Login with root without password” is really a proof, that their quality is unbeatable.
Now just use PageViewCustom::create() instead of PageView::create(). This will prevent the PageView from resizing your Layout nodes. Just set your Layout nodes to half the width of your PageView (that is, your PageViewCustom) and you should get the effect you want.
Well, looks like nothing… it’s same code as in 1-st post, except it ofc uses PageViewCustom now.
Also, I’m adding 16 items. and some misc: setItemsMargin(35.0f); items size is 52px square.
Just checked, added up to 8 items - no problems, but with 9+ items I got this bounce back problem.
Hmm… thats very strange, I’m now moved my code(from the actual game, as was gif example showed) to UIPageViewTest and just edited source main PageView.cpp and disabled item->setContentSize(this->getContentSize());
and got no problems there too…
Upd: found code to reproduce issue(my bad with sizes, tweaked code from my game for diff size):
I just ised it for debug, for my game there are noticeable not centered problem compare to other items. I can use just maybe some sprite for debug, but I just want to say that problem is there. I have small items and it’s more noticeable.
upd: found some specific scale for node in my game. Fixed it and now everything ok, center was not a problem with PageView.
So almost fixed buggy built in class That glitch with jumping to some page…
This topic is now closed due to the off topic posts and memes I had to delete. Please do not start another topic about this unless if becomes relevant again.
@tbot9000 I have just implemented similar effect to the one with the “coins” with PageView (it may be also done with ListView). First of all you need to get the position of the “current” page - this is your “reference” position. Then, based on this position and distance between the current position and the target position you calculate the “percentage” offset. If view is the current view then offset is 100%. If is not current (any other) offset is 0%. This value is enough to set any effect you want. Ah… all the calculations are done in “update(dt)” method, so you will also get this “smooth” effect. This is the idea I am using and I decided to share, because I was also looking for it
Add all your pages to PageView (_pagesView) and store them in helper “_pages” vector.
In my case I put nodes additionaly into Layout node and then to PageView.
Save the position of the current page for later.
auto currentPage = _pagesView->getItem(_pagesView->getCurrentPageIndex());
_pageCurrentPosition = currentPage->getParent()->convertToWorldSpace(currentPage->getPosition());
Call scheduleUpdate().
update(float dt)
float factor = 1.0f;
for (auto it = _pages.begin(); it != _pages.end(); ++it)
{
auto page = (*it);
auto pos = page->getParent()->convertToWorldSpace(page->getPosition());
float delta = abs(pos.x - _pageCurrentPosition.x);
if (delta >= _pageSize.width)
{
factor = TARGET_SCALE;
}
else
{
factor = 1.0f - delta / _pageSize.width * (1.0f - TARGET_SCALE);
}
// Get the child you want to scale/modify based on the factor.
page->getChildByTag(PAGE_CONTENT_TAG)->setScale(factor);
}
TARGET_SCALE is the scale of any other page than the current one.
Of course you can “extend” it. For example you can calculate factor based on the full size of the _pagesView etc. Calculated factor gives you a lot of possibilites how to animate views. Here I just scale views.