Sha256: 71875314834d5c1f947fb60841080e4c23ed67a2d1c254df7b000844ea6eb713
Contents?: true
Size: 994 Bytes
Versions: 1
Compression:
Stored size: 994 Bytes
Contents
motion_require "base" =begin { from: 1.0, to: 1.2 } =end module Walt module Operation class ScaleOperation < 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) scale = CABasicAnimation.animationWithKeyPath("transform.scale") from = self.from || view.instance_variable_get("@__last_scale") || 1.0 scale.fromValue = NSNumber.numberWithFloat(from) scale.toValue = NSNumber.numberWithFloat(self.to) view.instance_variable_set("@__last_scale", scale.toValue.to_f) scale.duration = animation.duration scale.removedOnCompletion = false scale.fillMode = KCAFillModeForwards view.layer.addAnimation(scale, forKey:nil) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
walt-0.1.2 | lib/walt/operation/scale.rb |