i have a curve slider that takes in value from the height of the frame which value from -100 to 300 which i need to calculate it to equal the value of 0 to 10.
how can i calculate the negative value as what i had gotten was negative value?
my math is bad :(
-(NSUInteger)calculatePoints:(float)pointY
{
NSLog(@"maxOffsetValue %f minOffsetValue %fand pointY %f",maxOffsetValue,minOffsetValue, pointY);
float value = maxOffsetValue + minOffsetValue;
NSLog(@"value %f",value);
float normalValue = (pointY * 1.5) / value ;
NSLog(@"normalValue %f",normalValue);
return normalValue;
}
//set value from point
-(void) setValueFromPoint:(CGPoint) point
{
[animationTimer invalidate];
NSInteger value = [self calculatePoints:point.y];
value = ((value / self.frame.size.height) * self.max);
NSLog(@"raw value %d",value);
value < 0 ? value = 0 : value;
value > self.max ? value = self.max : value;
self->_value = value;
NSLog(@"Value %d",value);
}