question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What to use instead parallel(...)?

See original GitHub issue

What to use instead native parallel(…) method of for example in such a function?

`const open = () => {
  
  scrollRef && scrollRef.current
    ? scrollRef.current.scrollTo({x: 0, y: 0, animated: true})
    : null;
  setBabyOpened(true);
  Animated.parallel([
    Animated.timing(animationPositionX, {
      toValue: 0,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationPositionY, {
      toValue: 0,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationButtonCloseTop, {
      toValue: base * 12,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationButtonCloseRight, {
      toValue: base * 12,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationWidth, {
      toValue: screenWidth,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationViewHeight, {
      toValue: OPENEDHEIGHT,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationHeight, {
      toValue: screenHeight,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationPreViewHeight, {
      toValue: screenHeight,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationRadius, {
      toValue: 0,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationImageWidth, {
      toValue: OPENEDHEIGHT - base * 128,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationImageHeight, {
      toValue: OPENEDHEIGHT - base * 128,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationImagePositionX, {
      toValue: -base * 24,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationImagePositionY, {
      toValue: base * 24,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationImageRotate, {
      toValue: 0.15,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationCloseOpacity, {
      toValue: 1,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationProgressWidth, {
      toValue: screenWidth * 1 - base * 48,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationProgressBottom, {
      toValue: base * 88,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationInfoOpacity, {
      toValue: 1,
      duration: animationDuration,
      useNativeDriver: false,
    }),
    Animated.timing(animationFruitHeight, {
      toValue:
        screenHeight <= 580
          ? screenHeight - OPENEDHEIGHT + base * 72
          : screenHeight - OPENEDHEIGHT,
      duration: animationDuration * 2,
      useNativeDriver: false,
    }),
    Animated.timing(animationGradientHeight, {
      toValue:
        screenHeight <= 670
          ? screenHeight <= 580
            ? -base * 163
            : -base * 83
          : -base * 63,
      duration: animationDuration,
      useNativeDriver: false,
    }),
  ]).start();
  };`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakub-gonetcommented, Apr 14, 2020

Hi @Goldyukol,

you can try using Transitions or keep a list of Value nodes which will act like flags, so you can use cond(eq(flag, 1), (your animation)) and just set it off like that: map(flags, flag => flag.setValue(1))

I believe there are more ways to do that too.

Related issue: #81

Hope that helps.

0reactions
pbtkhoacommented, Aug 27, 2020

I would suggest to have single animation value, animation from 0 to 1 and to use interpolate for everything else where input is [0, 1] and output is [currentValue, toValue]

Could it parallel? Could you give me any simple example? I got stuck T__T

Read more comments on GitHub >

github_iconTop Results From Across the Web

99 Synonyms & Antonyms for PARALLEL - Thesaurus.com
WORDS RELATED TO PARALLEL ; agree. verbbe similar or consistent ; akin. adjectiverelated or connected ; alike. adjectivesimilar.
Read more >
139 Synonyms & Antonyms of PARALLEL - Merriam-Webster
Synonyms for PARALLEL: similar, analogous, comparable, like, alike, such, corresponding, matching; Antonyms of PARALLEL: different, dissimilar, unlike, ...
Read more >
Parallel for each or any alternative for parallel loop?
I would like to use parallelism to be sure I request my 8 calls together and not one by one. What should I...
Read more >
GNU Parallel alternatives - UPC Displays
prll encourages using BASH aliases and BASH functions instead of scripts. GNU parallel supports scripts directly, functions if they are exported using ......
Read more >
Smart async/await pattern to execute in parallel (alternative to ...
Sometimes we can't use Promise.all() and Promise.allSettled() in some cases. Cases like when it's really important for us to execute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found