BasicTween
Discussion thread | Moderator | Status |
---|---|---|
Should we enforce one BasicTween per property? | pingpongboss | Proposed on Oct 12, 2016 |
Rename Tween to BasicTween | appsforartists | Accepted on Nov 1, 2016 |
Example: Fade in
Transition Fade {
func setUp() {
runtime.addPlan(
BasicTween(
.opacity,
from: 0,
to: 1,
withTimingFunction: .easeInOut,
duration: 300,
delay: 0,
),
to: target
)
}
}
Contract
Linearly interpolate a target's property from one value to another using a timing function for velocity.
Plan BasicTween {
var property
var from
var to
var timingFunction
var duration
var delay
}
property
is any animatable value on the target object.
from
is a value whose types matches that of the property.
to
is a value whose types matches that of the property.
timingFunction
is a cubic-bezier timing function.
duration
is the length of time over which the animation should occur, expressed in milliseconds (e.g. 300 milliseconds).
delay
is the number of milliseconds that should elapse before a tween begins.
For platforms that support a model/presentation layer separation, the from
and to
values can be optional. Consider the following situations:
Both
from
andto
are provided. Interpolates betweenfrom
andto
.Only
from
is provided. Interpolates betweenfrom
and the current presentation value of the property.Only
to
is provided. Interpolates between the current value of the property andto
.