feat:change animator api
This commit is contained in:
parent
fb47613b89
commit
75fe22290a
@ -15,11 +15,15 @@
|
||||
*/
|
||||
import { Panel } from "../ui/panel"
|
||||
import { takeLet } from "../pattern/candies"
|
||||
import { BridgeContext } from "../runtime/global"
|
||||
/**
|
||||
* Only supports x,y,width,height,corner(just for four corners),rotation,bgColor,
|
||||
* @param panel @see Panel
|
||||
*/
|
||||
export function animate(panel: Panel) {
|
||||
export function animate(context: BridgeContext) {
|
||||
const entity = context.entity
|
||||
if (entity instanceof Panel) {
|
||||
let panel = entity
|
||||
return (args: {
|
||||
animations: () => void,
|
||||
duration: number,
|
||||
@ -48,4 +52,13 @@ export function animate(panel: Panel) {
|
||||
})
|
||||
}) as Promise<any>
|
||||
}
|
||||
} else {
|
||||
return (args: {
|
||||
animations: () => void,
|
||||
duration: number,
|
||||
}) => {
|
||||
return Promise.reject(`Cannot find panel in Context:${context.id}`)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
import { Modeling, Model } from "../util/types"
|
||||
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
@ -16,6 +14,7 @@ import { Modeling, Model } from "../util/types"
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Modeling, Model } from "../util/types"
|
||||
|
||||
export type AnimatedKey = "translationX" | "translationY" | "scaleX" | "scaleY" | "rotation" | "pivotX" | "pivotY"
|
||||
|
||||
|
Reference in New Issue
Block a user