* Update the current value from outside the frameloop, * and return the `Animated` node.
(arg: T | FluidValue<T>, idle = true)
| 934 | * and return the `Animated` node. |
| 935 | */ |
| 936 | protected _set(arg: T | FluidValue<T>, idle = true): Animated | undefined { |
| 937 | const value = getFluidValue(arg) |
| 938 | if (!is.und(value)) { |
| 939 | const oldNode = getAnimated(this) |
| 940 | if (!oldNode || !isEqual(value, oldNode.getValue())) { |
| 941 | // Create a new node or update the existing node. |
| 942 | const nodeType = getAnimatedType(value) |
| 943 | if (!oldNode || oldNode.constructor != nodeType) { |
| 944 | setAnimated(this, nodeType.create(value)) |
| 945 | } else { |
| 946 | oldNode.setValue(value) |
| 947 | } |
| 948 | // Never emit a "change" event for the initial value. |
| 949 | if (oldNode) { |
| 950 | raf.batchedUpdates(() => { |
| 951 | this._onChange(value, idle) |
| 952 | }) |
| 953 | } |
| 954 | } |
| 955 | } |
| 956 | return getAnimated(this) |
| 957 | } |
| 958 | |
| 959 | protected _onStart() { |
| 960 | const anim = this.animation |
no test coverage detected