Example #1
0
    def calculate_next_step(cls, current_step, start_value, change_in_value,
                            number_of_steps):
        progress = LinearEase().calculate_next_step(current_step, start_value,
                                                    change_in_value,
                                                    number_of_steps)

        quintic = SinusoidalEase().calculate_next_step(current_step,
                                                       start_value,
                                                       change_in_value,
                                                       number_of_steps)
        bounce = BounceEaseOut().calculate_next_step(current_step, start_value,
                                                     change_in_value,
                                                     number_of_steps)

        if progress > 0.2 and abs(quintic -
                                  bounce) < 0.1:  # This is very dangerous
            return bounce
        else:
            return quintic
Example #2
0
    def move_first(self):

        motor = self.robot.m5
        controller = EasingController(motor, LinearEase(), 5000)

        controller.goal = -50
        for move in controller:
            motor.goal_position = move
            time.sleep(0.0002)
        else:
            print("Move done")

        controller.goal = -70

        time.sleep(2)

        for move in controller:
            motor.goal_position = move
            time.sleep(0.0002)
        else:
            print("Move done")

        self.robot.stop_sync()
 def calculate_next_step(cls, current_step, start_value, change_in_value,
                         number_of_steps):
     position = LinearEase.calculate_next_step(current_step, start_value,
                                               change_in_value,
                                               number_of_steps)
     return pytweening.easeInOutElastic(position)
Example #4
0
 def calculate_next_step(self, current_step, start_value, change_in_value,
                         number_of_steps):
     position = LinearEase.calculate_next_step(current_step, start_value,
                                               change_in_value,
                                               number_of_steps)
     return pytweening.easeOutCirc(position)
Example #5
0
 def calculate_next_step(cls, current_step, start_value, change_in_value,
                         number_of_steps):
     position = LinearEase.calculate_next_step(current_step, start_value,
                                               change_in_value,
                                               number_of_steps)
     return cls.bounce_ease_in_out(position)