mirror of
https://github.com/status-im/status-react.git
synced 2025-02-28 02:20:50 +00:00
30 lines
707 B
JavaScript
30 lines
707 B
JavaScript
|
// Generic Worklets
|
||
|
|
||
|
export function applyAnimationsToStyle(animations, style) {
|
||
|
return function() {
|
||
|
'worklet'
|
||
|
|
||
|
var animatedStyle = {}
|
||
|
|
||
|
for (var key in animations) {
|
||
|
if (key == "transform") {
|
||
|
var transforms = animations[key];
|
||
|
var animatedTransforms = []
|
||
|
|
||
|
for (var transform of transforms) {
|
||
|
var transformKey = Object.keys(transform)[0];
|
||
|
animatedTransforms.push({
|
||
|
[transformKey]: transform[transformKey].value
|
||
|
})
|
||
|
}
|
||
|
|
||
|
animatedStyle[key] = animatedTransforms;
|
||
|
} else {
|
||
|
animatedStyle[key] = animations[key].value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return Object.assign(animatedStyle, style);
|
||
|
};
|
||
|
};
|