divkit.dsl.ChangeBoundsTransition.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
/**
* Element position and size change animation.
*
* Can be created using the method [changeBoundsTransition].
*
* Required parameters: `type`.
*/
@Generated
class ChangeBoundsTransition internal constructor(
@JsonIgnore
val properties: Properties,
) : ChangeTransition {
@JsonAnyGetter
internal fun getJsonProperties(): Map = properties.mergeWith(
mapOf("type" to "change_bounds")
)
operator fun plus(additive: Properties): ChangeBoundsTransition = ChangeBoundsTransition(
Properties(
duration = additive.duration ?: properties.duration,
interpolator = additive.interpolator ?: properties.interpolator,
startDelay = additive.startDelay ?: properties.startDelay,
)
)
class Properties internal constructor(
/**
* Animation duration in milliseconds.
* Default value: `200`.
*/
val duration: 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("duration", duration)
result.tryPutProperty("interpolator", interpolator)
result.tryPutProperty("start_delay", startDelay)
return result
}
}
}
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun DivScope.changeBoundsTransition(
`use named arguments`: Guard = Guard.instance,
duration: Int? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
): ChangeBoundsTransition = ChangeBoundsTransition(
ChangeBoundsTransition.Properties(
duration = valueOrNull(duration),
interpolator = valueOrNull(interpolator),
startDelay = valueOrNull(startDelay),
)
)
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun DivScope.changeBoundsTransitionProps(
`use named arguments`: Guard = Guard.instance,
duration: Int? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
) = ChangeBoundsTransition.Properties(
duration = valueOrNull(duration),
interpolator = valueOrNull(interpolator),
startDelay = valueOrNull(startDelay),
)
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun TemplateScope.changeBoundsTransitionRefs(
`use named arguments`: Guard = Guard.instance,
duration: ReferenceProperty? = null,
interpolator: ReferenceProperty? = null,
startDelay: ReferenceProperty? = null,
) = ChangeBoundsTransition.Properties(
duration = duration,
interpolator = interpolator,
startDelay = startDelay,
)
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun ChangeBoundsTransition.override(
`use named arguments`: Guard = Guard.instance,
duration: Int? = null,
interpolator: AnimationInterpolator? = null,
startDelay: Int? = null,
): ChangeBoundsTransition = ChangeBoundsTransition(
ChangeBoundsTransition.Properties(
duration = valueOrNull(duration) ?: properties.duration,
interpolator = valueOrNull(interpolator) ?: properties.interpolator,
startDelay = valueOrNull(startDelay) ?: properties.startDelay,
)
)
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun ChangeBoundsTransition.defer(
`use named arguments`: Guard = Guard.instance,
duration: ReferenceProperty? = null,
interpolator: ReferenceProperty? = null,
startDelay: ReferenceProperty? = null,
): ChangeBoundsTransition = ChangeBoundsTransition(
ChangeBoundsTransition.Properties(
duration = duration ?: properties.duration,
interpolator = interpolator ?: properties.interpolator,
startDelay = startDelay ?: properties.startDelay,
)
)
/**
* @param duration Animation duration in milliseconds.
* @param interpolator Transition speed nature.
* @param startDelay Delay in milliseconds before animation starts.
*/
@Generated
fun ChangeBoundsTransition.evaluate(
`use named arguments`: Guard = Guard.instance,
duration: ExpressionProperty? = null,
interpolator: ExpressionProperty? = null,
startDelay: ExpressionProperty? = null,
): ChangeBoundsTransition = ChangeBoundsTransition(
ChangeBoundsTransition.Properties(
duration = duration ?: properties.duration,
interpolator = interpolator ?: properties.interpolator,
startDelay = startDelay ?: properties.startDelay,
)
)
@Generated
fun ChangeBoundsTransition.asList() = listOf(this)