This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-demo/src/AnimationsDemo.ts
2021-04-22 14:57:51 +08:00

49 lines
1.5 KiB
TypeScript

import { Group, Panel, Color, LayoutSpec, View, layoutConfig, flexlayout, image, ScaleType, Align, FlexDirection, Wrap, stack, vlayout, text, hlayout, modal, Gravity, TranslationAnimation } from "doric";
import { icon_refresh } from "./utils";
@Entry
class Animations extends Panel {
build(root: Group) {
const animation = new TranslationAnimation
animation.fromTranslationX = 0
animation.toTranslationX = 100
animation.duration = 5000
let view: View
vlayout(
[
view = stack([], {
layoutConfig: layoutConfig().just(),
width: 20,
height: 20,
backgroundColor: Color.BLUE,
}),
text({
text: "Start",
onClick: () => {
view.doAnimation(context, animation)
}
}),
text({
text: "Cancel",
onClick: () => {
view.cancelAnimation(context, animation)
}
}),
text({
text: "Clear",
onClick: () => {
view.clearAnimation(context, animation)
}
}),
],
{
space: 20,
layoutConfig: layoutConfig().most(),
gravity: Gravity.Center
}).in(root)
}
}