Loading...
Loading...
Kuikly DSL Animation Development Assistant (Kuikly DSL). Guides users to implement property animations such as transform, opacity, backgroundColor, and frame using both declarative and imperative approaches, covering serial/parallel orchestration and animation cancellation. Used when users need to implement animation effects.
npx skill4agent add tencent-tds/kuiklyui-ai kuikly-animation| Feature | Declarative Animation | Imperative Animation |
|---|---|---|
| Trigger method | Automatically triggered by reactive variable changes | Manually call |
| Core API | | |
| Applicable scenarios | Simple state transition animations | Complex animation orchestration, serial animations |
| Completion callback | | Callback via |
| Recommendation | Preferred for simple animations | Recommended for complex animations |
// Basic curves
Animation.linear(durationS, key = "") // Linear
Animation.easeIn(durationS, key = "") // Ease in (slow start, fast end)
Animation.easeOut(durationS, key = "") // Ease out (fast start, slow end)
Animation.easeInOut(durationS, key = "") // Ease in-out (slow at both ends, fast in the middle)
// Spring curves (additional parameters: damping, initial velocity)
Animation.springLinear(durationS, damping, velocity, key = "")
Animation.springEaseIn(durationS, damping, velocity, key = "")
Animation.springEaseOut(durationS, damping, velocity, key = "")
Animation.springEaseInOut(durationS, damping, velocity, key = "")Animation.linear(0.5f)
.delay(0.3f) // Start with 0.3s delay
.repeatForever(true) // Infinite loop| Parameter | Type | Description |
|---|---|---|
| durationS | Float | Animation duration (seconds) |
| key | String | Animation identifier, used to distinguish animations in animationCompletion callback |
| damping | Float | Spring damping coefficient |
| velocity | Float | Initial spring velocity |
| Class | Constructor Parameters | Description |
|---|---|---|
| X/Y translation percentage [-1,1], can exceed range | Translation, supports offsetX/offsetY (dp) |
| Scaling ratio [0, max] | Scaling |
| Angle [-360, 360] | 2D rotation (around Z-axis) |
| Angle of each axis | 3D rotation |
| Skew angle (-90, 90) | Skewing |
| Anchor point [0, 1] | Transform center point, default (0.5, 0.5) |
fun transform(
rotate: Rotate = Rotate.DEFAULT,
scale: Scale = Scale.DEFAULT,
translate: Translate = Translate.DEFAULT,
anchor: Anchor = Anchor.DEFAULT,
skew: Skew = Skew.DEFAULT
)
// Convenient overloads (only pass a single transform type)
fun transform(rotate: Rotate)
fun transform(scale: Scale)
fun transform(translate: Translate)
fun transform(skew: Skew)var flag by observable(false)
View {
attr {
size(100f, 100f)
backgroundColor(if (ctx.flag) Color.GREEN else Color.RED)
animate(Animation.linear(0.5f), ctx.flag)
}
}
// Trigger animation
flag = truevar viewRef: ViewRef<DivView>? = null
View {
ref { ctx.viewRef = it }
attr {
size(100f, 100f)
backgroundColor(Color.RED)
}
}
// Trigger animation
viewRef?.view?.animateToAttr(Animation.linear(0.5f), attrBlock = {
backgroundColor(Color.GREEN)
}, completion = { finished ->
// finished: true=completed, false=canceled
})