i want to let the user touch the screen and i take these touches size and location and provide him with an image "as if it" was his fingerprint but with almost the same shape and size of his finger
i implemented the touchesBegan Function and the touchesMoves Function as follows (both have the same code)
as it's shown below the touchSize is the size of the actual user touch to the screen and it holds the radius of the touch, then i created a circular shape using SKshapeNode and color and displayed it on screen
it colors the node where i touched but when i move a touch the size starts to get bigger and i can not get it to draw the shape of the finger
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
/* Called when a touch begins*/
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
CGFloat touchSize = [[touch valueForKey:@"pathMajorRadius"] floatValue];
SKShapeNode *touchedLocation = [SKShapeNode shapeNodeWithCircleOfRadius:touchSize/4];
touchedLocation.fillColor = [SKColor whiteColor];
touchedLocation.position = location;
[self addChild:touchedLocation];
}
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
CGFloat touchSize = [[touch valueForKey:@"pathMajorRadius"] floatValue];
isScreenTouched = YES;
SKShapeNode *touchedLocation = [SKShapeNode shapeNodeWithCircleOfRadius:touchSize/4];
touchedLocation.fillColor = [SKColor whiteColor];
touchedLocation.position = location;
touchedLocation.name = @"AnamelPrint";
[self addChild:touchedLocation];
}
}
Aucun commentaire:
Enregistrer un commentaire