RubAndReveal is a iOS library for you to create the effect of rubbing/wiping a front layer of image to reveal the back image.
pod 'RubAndReveal', '~> 0.1.1'
Objective-C
- instantiate the RubAndReveal view
RubAndReveal *demoView = [[RubAndReveal alloc] init];
-
configure the frame of the view
-
set the image
[demoView configureLayoutWithBackImage:backImage
frontImage:frontImage];
- add to subview
[self.view addSubview demoView];
- reset image if you want
[demoView resetImage];
Swift
- instantiate the RubAndReveal view
let demoView = RubAndReveal()
-
configure the frame of the view
-
set the image
demoView.configureLayoutWithBackImage(backImage, frontImage: frontImage)
- add to subview
self.view.addSubview(demoView)
- reset image if you want
demoView.resetImage()
you can change these properties for the RubAndReveal
view
NSString *lineCap
: it specifies the shape of the endpoints of an open path when rubNSString *lineJoin
: it specifies the style for join of the rubbing pathCGFloat lineWidth
: it specifies the width of the rubbing stroke