divkit.dsl.SlideTransition.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-json-builder Show documentation
Show all versions of kotlin-json-builder Show documentation
DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.
@file:Suppress(
"unused",
"UNUSED_PARAMETER",
)
package divkit.dsl
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map
/**
* Slide animation.
*
* Can be created using the method [slideTransition].
*
* Required parameters: `type`.
*/
@Generated
class SlideTransition internal constructor(
@JsonIgnore
val properties: Properties,
) : AppearanceTransition {
@JsonAnyGetter
internal fun getJsonProperties(): Map = properties.mergeWith(
mapOf("type" to "slide")
)
operator fun plus(additive: Properties): SlideTransition = SlideTransition(
Properties(
distance = additive.distance ?: properties.distance,
duration = additive.duration ?: properties.duration,
edge = additive.edge ?: properties.edge,
interpolator = additive.interpolator ?: properties.interpolator,
startDelay = additive.startDelay ?: properties.startDelay,
)
)
class Properties internal constructor(
/**
* A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
*/
val distance: Property?,
/**
* Animation duration in milliseconds.
* Default value: `200`.
*/
val duration: Property?,
/**
* Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* Default value: `bottom`.
*/
val edge: Property?,
/**
* Transition speed nature.
* Default value: `ease_in_out`.
*/
val interpolator: Property?,
/**
* Delay in milliseconds before animation starts.
* Default value: `0`.
*/
val startDelay: Property?,
) {
internal fun mergeWith(properties: Map): Map {
val result = mutableMapOf()
result.putAll(properties)
result.tryPutProperty("distance", distance)
result.tryPutProperty("duration", duration)
result.tryPutProperty("edge", edge)
result.tryPutProperty("interpolator", interpolator)
result.tryPutProperty("start_delay", startDelay)
return result
}
}
/**
* Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
*
* Possible values: [left], [top], [right], [bottom].
*/
@Generated
sealed interface Edge
}
/**
* @param distance A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun DivScope.slideTransition(
`use named arguments`: Guard = Guard.instance,
distance: Dimension? = null,
duration: Int? = null,
edge: SlideTransition.Edge? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
): SlideTransition = SlideTransition(
SlideTransition.Properties(
distance = valueOrNull(distance),
duration = valueOrNull(duration),
edge = valueOrNull(edge),
interpolator = valueOrNull(interpolator),
startDelay = valueOrNull(startDelay),
)
)
/**
* @param distance A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun DivScope.slideTransitionProps(
`use named arguments`: Guard = Guard.instance,
distance: Dimension? = null,
duration: Int? = null,
edge: SlideTransition.Edge? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
) = SlideTransition.Properties(
distance = valueOrNull(distance),
duration = valueOrNull(duration),
edge = valueOrNull(edge),
interpolator = valueOrNull(interpolator),
startDelay = valueOrNull(startDelay),
)
/**
* @param distance A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun TemplateScope.slideTransitionRefs(
`use named arguments`: Guard = Guard.instance,
distance: ReferenceProperty? = null,
duration: ReferenceProperty? = null,
edge: ReferenceProperty? = null,
interpolator: ReferenceProperty? = null,
startDelay: ReferenceProperty? = null,
) = SlideTransition.Properties(
distance = distance,
duration = duration,
edge = edge,
interpolator = interpolator,
startDelay = startDelay,
)
/**
* @param distance A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun SlideTransition.override(
`use named arguments`: Guard = Guard.instance,
distance: Dimension? = null,
duration: Int? = null,
edge: SlideTransition.Edge? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
): SlideTransition = SlideTransition(
SlideTransition.Properties(
distance = valueOrNull(distance) ?: properties.distance,
duration = valueOrNull(duration) ?: properties.duration,
edge = valueOrNull(edge) ?: properties.edge,
interpolator = valueOrNull(interpolator) ?: properties.interpolator,
startDelay = valueOrNull(startDelay) ?: properties.startDelay,
)
)
/**
* @param distance A fixed value of an offset which the element starts appearing from or at which it finishes disappearing. If no value is specified, the distance to the selected edge of a parent element is used.
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun SlideTransition.defer(
`use named arguments`: Guard = Guard.instance,
distance: ReferenceProperty? = null,
duration: ReferenceProperty? = null,
edge: ReferenceProperty? = null,
interpolator: ReferenceProperty? = null,
startDelay: ReferenceProperty? = null,
): SlideTransition = SlideTransition(
SlideTransition.Properties(
distance = distance ?: properties.distance,
duration = duration ?: properties.duration,
edge = edge ?: properties.edge,
interpolator = interpolator ?: properties.interpolator,
startDelay = startDelay ?: properties.startDelay,
)
)
/**
* @param duration Animation duration in milliseconds.
* @param edge Edge of a parent element for one of the action types:where the element will move from when appearing; where the element will move to when disappearing.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun SlideTransition.evaluate(
`use named arguments`: Guard = Guard.instance,
duration: ExpressionProperty? = null,
edge: ExpressionProperty? = null,
interpolator: ExpressionProperty? = null,
startDelay: ExpressionProperty? = null,
): SlideTransition = SlideTransition(
SlideTransition.Properties(
distance = properties.distance,
duration = duration ?: properties.duration,
edge = edge ?: properties.edge,
interpolator = interpolator ?: properties.interpolator,
startDelay = startDelay ?: properties.startDelay,
)
)
@Generated
fun SlideTransition.asList() = listOf(this)
@Generated
fun SlideTransition.Edge.asList() = listOf(this)