How to use the slider.beatmap.Circle function in slider

To help you get started, we’ve selected a few slider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github llllllllll / slider / slider / beatmap.py View on Github external
def _calculate_strain(self, previous, strain):
        result = 0
        scaling = self.weight_scaling[strain]

        hit_object = self.hit_object
        if isinstance(hit_object, (Circle, Slider)):
            result = self._spacing_weight(
                self._distance(previous),
                strain
            ) * scaling

        time_elapsed = (
            self.hit_object.time -
            previous.hit_object.time
        ).total_seconds() * 1000
        result /= max(time_elapsed, 50)
        decay = (
            self.decay_base[strain] **
            (time_elapsed / 1000)
        )
        return previous.strains[strain] * decay + result
github llllllllll / slider / slider / model / features.py View on Github external
Returns
    -------
    circles : int
        The count of circles.
    sliders : int
        The count of sliders.
    spinners : int
        The count of spinners.
    """
    circles = 0
    sliders = 0
    spinners = 0

    for hit_object in hit_objects:
        if isinstance(hit_object, Circle):
            circles += 1
        elif isinstance(hit_object, Slider):
            sliders += 1
        else:
            spinners += 1

    return hit_object_count(circles, sliders, spinners)
github circleguard / circleguard / circleguard / visualizer / visualizer.py View on Github external
def draw_hitobject(self, hitobj):
        """
        Calls corresponding functions to draw a Hitobject.

        Args:
            QPainter painter: The painter.
            Hitobj hitobj: A Hitobject.
        """
        if isinstance(hitobj, Circle):
            self.draw_hitcircle(hitobj)
            self.draw_approachcircle(hitobj)
        if isinstance(hitobj, Slider):
            self.draw_slider(hitobj)
        if isinstance(hitobj, Spinner):
            self.draw_spinner(hitobj)
github circleguard / circleguard / circleguard / visualizer / visualizer.py View on Github external
def get_hit_endtime(self, hitobj):
        return hitobj.end_time.total_seconds() * 1000 if not isinstance(hitobj, Circle) else self.get_hit_time(hitobj)
github llllllllll / slider / slider / replay.py View on Github external
if isinstance(obj, Spinner):
                # spinners are hard
                scores['300s'].append(obj)
                continue
            # we can ignore events before the hit window so iterate
            # until we get past the beginning of the hit window
            while actions[i].offset < obj.time - hit_50_threshold:
                i += 1
            starti = i
            while actions[i].offset < obj.time + hit_50_threshold:
                if (((actions[i].key1 and not actions[i - 1].key1)
                        or (actions[i].key2 and not actions[i - 1].key2))
                        and _within(actions[i].position, obj.position, rad)):
                    # key pressed that wasn't before and
                    # event is in hit window and correct location
                    if isinstance(obj, Circle):
                        _process_circle(obj, actions[i], hw, scores)
                    elif isinstance(obj, Slider):
                        # Head was hit
                        starti = i
                        while actions[i].offset <= obj.end_time:
                            i += 1
                        _process_slider(
                            obj, actions[starti:i + 1], True, rad, scores
                        )
                    break
                i += 1
            else:
                # no events in the hit window were in the correct location
                if isinstance(obj, Slider):
                    # Slider ticks might still be hit
                    while actions[i].offset <= obj.end_time:
github llllllllll / slider / slider / beatmap.py View on Github external
def circles(self):
        """Just the circles in the beatmap.
        """
        return tuple(e for e in self.hit_objects if isinstance(e, Circle))
github llllllllll / slider / slider / beatmap.py View on Github external
try:
            time = timedelta(milliseconds=int(time))
        except ValueError:
            raise ValueError(f'type should be an int, got {time!r}')

        try:
            type_ = int(type_)
        except ValueError:
            raise ValueError(f'type should be an int, got {type_!r}')

        try:
            hitsound = int(hitsound)
        except ValueError:
            raise ValueError(f'hitsound should be an int, got {hitsound!r}')

        if type_ & Circle.type_code:
            parse = Circle._parse
        elif type_ & Slider.type_code:
            parse = partial(
                Slider._parse,
                timing_points=timing_points,
                slider_multiplier=slider_multiplier,
                slider_tick_rate=slider_tick_rate,
            )
        elif type_ & Spinner.type_code:
            parse = Spinner._parse
        elif type_ & HoldNote.type_code:
            parse = HoldNote._parse
        else:
            raise ValueError(f'unknown type code {type_!r}')

        return parse(Position(x, y), time, hitsound, rest)
github llllllllll / slider / slider / beatmap.py View on Github external
time = timedelta(milliseconds=int(time))
        except ValueError:
            raise ValueError(f'type should be an int, got {time!r}')

        try:
            type_ = int(type_)
        except ValueError:
            raise ValueError(f'type should be an int, got {type_!r}')

        try:
            hitsound = int(hitsound)
        except ValueError:
            raise ValueError(f'hitsound should be an int, got {hitsound!r}')

        if type_ & Circle.type_code:
            parse = Circle._parse
        elif type_ & Slider.type_code:
            parse = partial(
                Slider._parse,
                timing_points=timing_points,
                slider_multiplier=slider_multiplier,
                slider_tick_rate=slider_tick_rate,
            )
        elif type_ & Spinner.type_code:
            parse = Spinner._parse
        elif type_ & HoldNote.type_code:
            parse = HoldNote._parse
        else:
            raise ValueError(f'unknown type code {type_!r}')

        return parse(Position(x, y), time, hitsound, rest)