All Downloads are FREE. Search and download functionalities are using the official Maven repository.

divkit.dsl.Animation.kt Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 30.19.0
Show newest version
@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 animation parameters.
 * 
 * Can be created using the method [animation].
 * 
 * Required parameters: `name`.
 */
@Generated
class Animation internal constructor(
    @JsonIgnore
    val properties: Properties,
) {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(emptyMap())

    operator fun plus(additive: Properties): Animation = Animation(
        Properties(
            duration = additive.duration ?: properties.duration,
            endValue = additive.endValue ?: properties.endValue,
            interpolator = additive.interpolator ?: properties.interpolator,
            items = additive.items ?: properties.items,
            name = additive.name ?: properties.name,
            repeat = additive.repeat ?: properties.repeat,
            startDelay = additive.startDelay ?: properties.startDelay,
            startValue = additive.startValue ?: properties.startValue,
        )
    )

    class Properties internal constructor(
        /**
         * Animation duration in milliseconds.
         * Default value: `300`.
         */
        val duration: Property?,
        /**
         * Final value of an animation.
         */
        val endValue: Property?,
        /**
         * Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * Default value: `spring`. */ val interpolator: Property?, /** * Animation elements. */ val items: Property>?, /** * Animation type. */ val name: Property?, /** * Number of animation repetitions. * Default value: `{ "type": "infinity" }`. */ val repeat: Property?, /** * Delay in milliseconds before animation starts. * Default value: `0`. */ val startDelay: Property?, /** * Starting value of an animation. */ val startValue: Property?, ) { internal fun mergeWith(properties: Map): Map { val result = mutableMapOf() result.putAll(properties) result.tryPutProperty("duration", duration) result.tryPutProperty("end_value", endValue) result.tryPutProperty("interpolator", interpolator) result.tryPutProperty("items", items) result.tryPutProperty("name", name) result.tryPutProperty("repeat", repeat) result.tryPutProperty("start_delay", startDelay) result.tryPutProperty("start_value", startValue) return result } } /** * Animation type. * * Possible values: [fade], [translate], [scale], [native], [set], [no_animation]. */ @Generated sealed interface Name } /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param items Animation elements. * @param name Animation type. * @param repeat Number of animation repetitions. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun DivScope.animation( `use named arguments`: Guard = Guard.instance, duration: Int? = null, endValue: Double? = null, interpolator: AnimationInterpolator? = null, items: List? = null, name: Animation.Name? = null, repeat: Count? = null, startDelay: Int? = null, startValue: Double? = null, ): Animation = Animation( Animation.Properties( duration = valueOrNull(duration), endValue = valueOrNull(endValue), interpolator = valueOrNull(interpolator), items = valueOrNull(items), name = valueOrNull(name), repeat = valueOrNull(repeat), startDelay = valueOrNull(startDelay), startValue = valueOrNull(startValue), ) ) /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param items Animation elements. * @param name Animation type. * @param repeat Number of animation repetitions. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun DivScope.animationProps( `use named arguments`: Guard = Guard.instance, duration: Int? = null, endValue: Double? = null, interpolator: AnimationInterpolator? = null, items: List? = null, name: Animation.Name? = null, repeat: Count? = null, startDelay: Int? = null, startValue: Double? = null, ) = Animation.Properties( duration = valueOrNull(duration), endValue = valueOrNull(endValue), interpolator = valueOrNull(interpolator), items = valueOrNull(items), name = valueOrNull(name), repeat = valueOrNull(repeat), startDelay = valueOrNull(startDelay), startValue = valueOrNull(startValue), ) /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param items Animation elements. * @param name Animation type. * @param repeat Number of animation repetitions. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun TemplateScope.animationRefs( `use named arguments`: Guard = Guard.instance, duration: ReferenceProperty? = null, endValue: ReferenceProperty? = null, interpolator: ReferenceProperty? = null, items: ReferenceProperty>? = null, name: ReferenceProperty? = null, repeat: ReferenceProperty? = null, startDelay: ReferenceProperty? = null, startValue: ReferenceProperty? = null, ) = Animation.Properties( duration = duration, endValue = endValue, interpolator = interpolator, items = items, name = name, repeat = repeat, startDelay = startDelay, startValue = startValue, ) /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param items Animation elements. * @param name Animation type. * @param repeat Number of animation repetitions. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun Animation.override( `use named arguments`: Guard = Guard.instance, duration: Int? = null, endValue: Double? = null, interpolator: AnimationInterpolator? = null, items: List? = null, name: Animation.Name? = null, repeat: Count? = null, startDelay: Int? = null, startValue: Double? = null, ): Animation = Animation( Animation.Properties( duration = valueOrNull(duration) ?: properties.duration, endValue = valueOrNull(endValue) ?: properties.endValue, interpolator = valueOrNull(interpolator) ?: properties.interpolator, items = valueOrNull(items) ?: properties.items, name = valueOrNull(name) ?: properties.name, repeat = valueOrNull(repeat) ?: properties.repeat, startDelay = valueOrNull(startDelay) ?: properties.startDelay, startValue = valueOrNull(startValue) ?: properties.startValue, ) ) /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param items Animation elements. * @param name Animation type. * @param repeat Number of animation repetitions. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun Animation.defer( `use named arguments`: Guard = Guard.instance, duration: ReferenceProperty? = null, endValue: ReferenceProperty? = null, interpolator: ReferenceProperty? = null, items: ReferenceProperty>? = null, name: ReferenceProperty? = null, repeat: ReferenceProperty? = null, startDelay: ReferenceProperty? = null, startValue: ReferenceProperty? = null, ): Animation = Animation( Animation.Properties( duration = duration ?: properties.duration, endValue = endValue ?: properties.endValue, interpolator = interpolator ?: properties.interpolator, items = items ?: properties.items, name = name ?: properties.name, repeat = repeat ?: properties.repeat, startDelay = startDelay ?: properties.startDelay, startValue = startValue ?: properties.startValue, ) ) /** * @param duration Animation duration in milliseconds. * @param endValue Final value of an animation. * @param interpolator Animation speed nature. When the value is set to `spring` — animation of damping fluctuations cut to 0.7 with the `damping=1` parameter. Other options correspond to the Bezier curve:
  • `linear` — cubic-bezier(0, 0, 1, 1);
  • `ease` — cubic-bezier(0.25, 0.1, 0.25, 1);
  • `ease_in` — cubic-bezier(0.42, 0, 1, 1);
  • `ease_out` — cubic-bezier(0, 0, 0.58, 1);
  • `ease_in_out` — cubic-bezier(0.42, 0, 0.58, 1).
  • * @param name Animation type. * @param startDelay Delay in milliseconds before animation starts. * @param startValue Starting value of an animation. */ @Generated fun Animation.evaluate( `use named arguments`: Guard = Guard.instance, duration: ExpressionProperty? = null, endValue: ExpressionProperty? = null, interpolator: ExpressionProperty? = null, name: ExpressionProperty? = null, startDelay: ExpressionProperty? = null, startValue: ExpressionProperty? = null, ): Animation = Animation( Animation.Properties( duration = duration ?: properties.duration, endValue = endValue ?: properties.endValue, interpolator = interpolator ?: properties.interpolator, items = properties.items, name = name ?: properties.name, repeat = properties.repeat, startDelay = startDelay ?: properties.startDelay, startValue = startValue ?: properties.startValue, ) ) @Generated fun Animation.asList() = listOf(this) @Generated fun Animation.Name.asList() = listOf(this)




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy