SORU
10 Kasım 2011, PERŞEMBE


yerel bir " Nasıl ios;Darbe etkisi" animasyon UİButton üzerinde

Nabız animasyon bir tür istiyorum (sonsuz döngü kullanıcılar alır bu yüzden "ölçek - ölçek") bir UİButton dikkatini hemen.

Bu bağlantı How to create a pulse effect using -web-kit animation - outward rings gördüm ama sadece kullanarak bu doğal çerçeve yapmak için herhangi bir yolu var mı diye soracaktım?

Herhangi bir yardım çok kod örneği, daha iyi takdir ;-)

CEVAP
10 Kasım 2011, PERŞEMBE


CABasicAnimation *theAnimation;

theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration=1.0;
theAnimation.repeatCount=HUGE_VALF;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
theAnimation.toValue=[NSNumber numberWithFloat:0.0];
[theLayer addAnimation:theAnimation forKey:@"animateOpacity"]; //myButton.layer instead of

Swift

let pulseAnimation = CABasicAnimation(keyPath: "opacity")
pulseAnimation.duration = 30
pulseAnimation.fromValue = 0
pulseAnimation.toValue = 1
pulseAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
pulseAnimation.autoreverses = true
pulseAnimation.repeatCount = FLT_MAX
self.view.layer.addAnimation(pulseAnimation, forKey: nil)

See this article

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • How To Cook That

    How To Cook

    16 NİSAN 2011
  • iNCH

    iNCH

    20 Temmuz 2009
  • nemoking of kinges

    nemoking of

    4 EYLÜL 2009