Open zats opened 7 years ago
Seems valid to me, but I can also see an argument for always starting from the property's current value being simpler. If nothing else, though, deserves to be documented that you'll want to set fromValue
as well as additive
.
I agree with the simplicity argument, but I'd probably strive for simplicity on the consumer side (not on the inside-the-framework side).
Although if it's critical to keep it the way it is, then yes, definitely worth a @note
in the documentation
Conceptually, it seems that when
CAAnimation.additive
is set toYES
, lack offromValue
should result in animation starting with0
(whatever it means in the context of particular property. For example:produces funky result. (I'm guessing it happens due to animation implicitly copying initial position to
animation.fromValue
)Following addition fixes it
Without knowing the underlying architecture, I'd assume that from consumer point of view, not assigning
fromValue
whenadditive
animation is enabled should produce animation from the current state totoValue
.If my guess about the reason is correct, fixing this might require a somewhat large switch statement going through all possible property types and suggesting default values (e.g.
@0
for numeric types,CGPointZero
forCGPoint
, not even sure what should it be for property ofCGAffineTransform
type)But before getting into engineering aspect of it, I'd love to hear some other perspectives - am I'm the only one who has this expectation?