Sha256: 086712f96502f8a1b95ad6f8843a5aed1be363205fb5a7e3f36074476eccc738
Contents?: true
Size: 1001 Bytes
Versions: 1
Compression:
Stored size: 1001 Bytes
Contents
=begin { from: 0, to: 45 } =end module Walt module Operation class RotateOperation < Base PROPERTIES = [:from, :to] attr_accessor *PROPERTIES def initialize(params = {}) super params.each do |key, value| if PROPERTIES.include?(key.to_sym) self.send("#{key}=", value) end end end def finalize(view, animation) rotate = CABasicAnimation.animationWithKeyPath("transform.rotation") from = self.from || view.instance_variable_get("@__last_rotation") || 0 rotate.fromValue = NSNumber.numberWithFloat(from) rotate.toValue = NSNumber.numberWithFloat(self.to * Math::PI / 180) view.instance_variable_set("@__last_rotation", rotate.toValue.to_f) rotate.duration = animation.duration rotate.removedOnCompletion = false rotate.fillMode = KCAFillModeForwards view.layer.addAnimation(rotate, forKey:nil) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
walt-0.1 | lib/walt/operation/rotate.rb |