allaboutapps / a3parallaxscrollview Goto Github PK
View Code? Open in Web Editor NEWA UIScrollview subclass with a high performance parallax scrolling effect
License: Other
A UIScrollview subclass with a high performance parallax scrolling effect
License: Other
Hi,
I used your library, but when I add an animation on the UIScrollView, I have a problem with the position of the viewBackground ?
My code :
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.viewContent setFrame:CGRectMake(0.0, 0.0, self.viewContent.frame.size.width, self.view.frame.size.height)];
[self.viewBackground setFrame:CGRectMake(0.0, 0.0, self.viewBackground.frame.size.width, self.view.frame.size.height)];
[self.scrollView setContentSize:CGSizeMake(self.viewContent.frame.size.width, self.view.frame.size.height)];
[self.scrollView addSubview:self.viewBackground withAcceleration:CGPointMake(0.5, 1.0)];
[self.scrollView addSubview:self.viewContent withAcceleration:A3DefaultAcceleration];
}
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[UIView beginAnimations:@"A3Animation" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDelay:0.5];
[UIView setAnimationDuration:1];
[self.scrollView setContentOffset:CGPointMake(self.view.frame.size.width, 0.0)];
[UIView commitAnimations];
}
replace the layoutsubvies with this:
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *v in self.subviews) {
// get acceleration
CGPoint accelecration = [self accelerationForView:v];
// move the view
[v.layer setAffineTransform:CGAffineTransformMakeTranslation(self.contentOffset.x*(1.0f-accelecration.x), self.contentOffset.y*(1.0f-accelecration.y))];
}
}
I can do a pull request if you want?
Preview image are not showing up
Great work. Would love to be able to install via Cocoapods.
Hi,
The contentOffset of a parallaxed SubView will be transformed depending of the acceleration.
It would be good to have a methd like this:
And it would return the adjusted ContentOffset for that view
Something like:
self.contentOffset * Acceleration (X and Y)
or just:
subview.transform. (Tx and tY)
What do you guys think?
Hi, it would be great if you could add a screenshot to the podspec and push the update to the specs repo. The screenshot is currently displayed on http://feeds.cocoapods.org and in future it will displayed on the search of http://cocoapods.org.
To learn more about the screenshot attribute, you can check the documentation here: http://guides.cocoapods.org/syntax/podspec.html#screenshots
Hello, how to use this library with SWIF langage ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.