Git Product home page Git Product logo

xblottery's Introduction

XBLottery

###IOS 客户端 转盘指针式抽奖系统

##代码

//设置好等级角度
_arrAngle = @[@[@[@"1",@"15"],@[@"165",@"195"],@[@"345",@"360"]],@[@[@"105",@"135"],@[@"285",@"315"]],@[@[@"45",@"75"],@[@"225",@"255"]],@[@[@"15",@"45"],@[@"75",@"105"],@[@"135",@"165"],@[@"195",@"225"],@[@"255",@"285"],@[@"315",@"345"]]];


///递归实现指针旋转
- (void)lotteryAction:(LotteryItem*)item
{
    if([item.time doubleValue] > 2)
    {
        if(item.angle > 180)
        {
            [UIView animateWithDuration:[item.time doubleValue] animations:^{
                _vLine.transform=CGAffineTransformMakeRotation(180*M_PI/180);
            }];
        }
        [UIView animateWithDuration:[item.time doubleValue] animations:^{
            _vLine.transform=CGAffineTransformMakeRotation(item.angle*M_PI/180);
        }];
    }
    else
    {
        [UIView animateWithDuration:[item.time doubleValue] animations:^{
            _vLine.transform=CGAffineTransformMakeRotation(180*M_PI/180);
        }];
        
        
        [UIView animateWithDuration:[item.time doubleValue] animations:^{
            _vLine.transform=CGAffineTransformMakeRotation(360*M_PI/180);
        }];
        
        
        NSNumber* _D = [NSNumber numberWithDouble:[item.time doubleValue] + 0.2];
        
        LotteryItem* _item = [[LotteryItem alloc] init];
        _item.time = _D;
        _item.angle = item.angle;
        
        [self performSelector:@selector(lotteryAction:) withObject:_item afterDelay:[item.time doubleValue] - [item.time doubleValue] / 2];
    }
}

##图示

xblottery's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.