CSS在改变方向之前暂停动画

时间:2016-04-15 18:07:14

标签: html css

有人可以向我解释如何在改变方向之前暂停动画吗?我希望它至少是一分钟的蓝色,然后再次开始转换为绿色并保持绿色一分钟等等......

<!DOCTYPE html>
<head>
</head>
<body>
</body>
</html>
    if EmailAddressTF.text=="" || PasswordTF.text=="" || BusinessNameTF.text==""
    {
        let alert = UIAlertController(title: "Oops!", message:"Make sure to fill in all required textfields", preferredStyle: .Alert)
        alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
        self.presentViewController(alert, animated: true){}
    }

    else {

        if RepasswordTF.text != PasswordTF.text
        {
            let alert = UIAlertController(title: "Oops!", message:"You Entered Different Passwords", preferredStyle: .Alert)
            alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
            self.presentViewController(alert, animated: true){}
        }

        else {

            let ref = Firebase(url: "https://businesswallet.firebaseio.com/")

            let mainpass = NSUserDefaults.standardUserDefaults().objectForKey("password") as? String
            let mainEmail = NSUserDefaults.standardUserDefaults().objectForKey("Email") as? String


            let isEqu = (mainEmail == self.EmailAddressTF.text)
            if(isEqu == true)
            {   }
            else
            {
                ref.changeEmailForUser(mainEmail, password: mainpass, toNewEmail: self.EmailAddressTF.text, withCompletionBlock: { error in

                    if error != nil {

                        if let errorCode = FAuthenticationError(rawValue: error.code) {

                            switch (errorCode) {
                            case .EmailTaken:
                                print("Email taken")
                                let alert = UIAlertController(title: "Oops!", message:"Sorry,Email taken", preferredStyle: .Alert)
                                alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
                                self.presentViewController(alert, animated:true){}

                            case .InvalidEmail:
                                print("invalid email")
                                let alert = UIAlertController(title: "Oops!", message:"invalid email", preferredStyle: .Alert)
                                alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
                               self.presentViewController(alert, animated:true){}


                            case .NetworkError:
                                print("Network Error")
                                let alert = UIAlertController(title: "Oops!", message:"Network error, check your connection", preferredStyle: .Alert)
                                alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
                                self.presentViewController(alert, animated: true){}

                            default:
                                print("Unknown Error")
                                let alert = UIAlertController(title: "Oops!", message:"Unknown Error", preferredStyle: .Alert)
                                alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
                                self.presentViewController(alert, animated: true){}
                            }
                        }





                    } else {

                        NSUserDefaults.standardUserDefaults().setValue(self.EmailAddressTF.text, forKey: "Email")
                        print("Email changed successfully")

                    }

                })

            } //Big Else

2 个答案:

答案 0 :(得分:0)

某事like this ?

您可以使用百分比代替set_prolog_flag(double_quotes,chars). from来更好地控制动画。

to

答案 1 :(得分:0)

您需要在动画中添加步骤: 例如,有2个额外步骤

&#13;
&#13;
@keyframes BackgroundColorChange1 {
	from{background-color: #87D61D}
	25%{background-color: #87D61D}
	75%{background-color:#7091BE}
	to{background-color:#7091BE}
}

	body {
	background-color:#87D61D;
	animation-name: BackgroundColorChange1;
	animation-duration: 5s;
	animation-iteration-count: infinite;
	animation-direction: alternate;
}
&#13;
<!DOCTYPE html>
<head>
</head>
<body>
</body>
</html>
&#13;
&#13;
&#13;