How to use slider - 10 common examples

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 / tests / test_beatmap.py View on Github external
102, 106, 111, 114, 116, 122, 124, 125, 126, 128, 129,
                            134, 135, 137, 138, 140, 141, 142, 144, 145, 147, 150,
                            156, 162, 177, 180, 183, 191, 193, 194, 195, 196, 197,
                            198, 199, 201, 203, 207, 208, 209, 210, 211, 213, 214,
                            228, 240, 241, 242, 245, 246, 249, 251, 252, 253, 256,
                            257, 258, 260, 261, 262, 263, 266, 283, 284, 288, 289,
                            290, 291, 294, 295, 297, 301, 302, 303, 304, 305, 307,
                            308, 309, 310, 313, 316, 320, 321, 322, 324, 325, 329]])
    assert hit_objects_stacked[7].stack_height == 1
    assert hit_objects_stacked[7].position == Position(x=281.352, y=223.352)
    assert hit_objects_stacked[31].stack_height == -1
    assert hit_objects_stacked[31].position == Position(x=286.648, y=230.648)
    # test hard_rock hit_objects
    hit_objects_hard_rock_0 = beatmap.hit_objects(hard_rock=True, stacking=False)[0]
    assert hit_objects_hard_rock_0.position == Position(x=243, y=220)
    assert hit_objects_0.curve.points == [Position(x=243, y=220),
                                          Position(x=301, y=209)]
github llllllllll / slider / tests / test_beatmap.py View on Github external
assert timing_points_0.offset == timedelta()
    assert isclose(timing_points_0.ms_per_beat, 307.692307692308)
    assert timing_points_0.meter == 4
    # sample_set and sample_type omitted, see #56
    assert timing_points_0.volume == 60
    # inherited is not in class parameter
    assert timing_points_0.kiai_mode == 0

    # [Colours] (skipped)
    # [HitObjects]
    # test first hit_object
    hit_objects_0 = beatmap.hit_objects(stacking=False)[0]
    assert hit_objects_0.position == Position(x=243, y=164)
    assert hit_objects_0.time == timedelta(milliseconds=1076)
    # Hit object note `type` is done by subclassing HitObject
    assert isinstance(hit_objects_0, slider.beatmap.Slider)
    # Slider specific parameters
    assert hit_objects_0.end_time == timedelta(milliseconds=1173)
    assert hit_objects_0.hitsound == 0
    assert isinstance(hit_objects_0.curve, slider.curve.Linear)
    assert hit_objects_0.curve.points == [Position(x=243, y=164),
                                          Position(x=301, y=175)]
    assert round(hit_objects_0.curve.req_length) == 45
    assert isclose(hit_objects_0.length, 45.0000017166138)
    assert hit_objects_0.ticks == 2
    assert hit_objects_0.num_beats == 0.3125
    assert hit_objects_0.tick_rate == 1.0
    assert isclose(hit_objects_0.ms_per_beat, 307.692307692308)
    assert hit_objects_0.edge_sounds == [2, 0]
    assert hit_objects_0.edge_additions == ['0:0', '0:0']
    assert hit_objects_0.addition == "0:0:0:0:"
    # test stacked hit_objects
github llllllllll / slider / tests / test_beatmap.py View on Github external
def test_beatmap_methods():
    # Difficulty calculations omitted
    beatmap = Beatmap.from_path(tatoe_path)

    # These functions take in mods
    assert beatmap.ar() == 9.5
    assert beatmap.bpm_min() == 180
    assert beatmap.bpm_max() == 195
    assert beatmap.cs() == 4
    assert beatmap.hp() == 6.5  # issue #57
    assert beatmap.od() == 9
github llllllllll / slider / tests / test_beatmap.py View on Github external
def test_beatmap_parameters():
    beatmap = Beatmap.from_path(tatoe_path)
    assert beatmap.format_version == 14
    assert beatmap.display_name == \
           "AKINO from bless4 & CHiCO with HoneyWorks - MIIRO " + \
           "vs. Ai no Scenario [Tatoe]"

    # [General]
    assert beatmap.audio_filename == "tatoe.mp3"
    assert beatmap.audio_lead_in == timedelta()
    assert beatmap.preview_time == timedelta(milliseconds=6538)
    assert beatmap.countdown == False
    assert beatmap.sample_set == "Normal"
    assert beatmap.stack_leniency == 0.7
    assert beatmap.mode == 0
    assert beatmap.letterbox_in_breaks == False
    assert beatmap.widescreen_storyboard == False
github llllllllll / slider / slider / replay.py View on Github external
compressed_byte_count = consume_int(buffer)
    compressed_data = buffer[:compressed_byte_count]
    del buffer[:compressed_byte_count]
    decompressed_data = lzma.decompress(compressed_data)

    out = []
    offset = 0
    for raw_action in decompressed_data.split(b','):
        if not raw_action:
            continue
        raw_offset, x, y, raw_action_mask = raw_action.split(b'|')
        action_mask = ActionBitMask.unpack(int(raw_action_mask))
        offset += int(raw_offset)
        out.append(Action(
            datetime.timedelta(milliseconds=offset),
            Position(float(x), float(y)),
            action_mask['m1'],
            action_mask['m2'],
            action_mask['k1'],
            action_mask['k2'],
        ))
    return out
github llllllllll / slider / slider / replay.py View on Github external
def _consume_actions(buffer):
    compressed_byte_count = consume_int(buffer)
    compressed_data = buffer[:compressed_byte_count]
    del buffer[:compressed_byte_count]
    decompressed_data = lzma.decompress(compressed_data)

    out = []
    offset = 0
    for raw_action in decompressed_data.split(b','):
        if not raw_action:
            continue
        raw_offset, x, y, raw_action_mask = raw_action.split(b'|')
        action_mask = ActionBitMask.unpack(int(raw_action_mask))
        offset += int(raw_offset)
        out.append(Action(
            datetime.timedelta(milliseconds=offset),
            Position(float(x), float(y)),
            action_mask['m1'],
github llllllllll / slider / slider / replay.py View on Github external
def _consume_life_bar_graph(buffer):
    life_bar_graph_raw = consume_string(buffer)
    return [
        (datetime.timedelta(milliseconds=int(offset)), float(value))
        for offset, value in (
            pair.split('|') for pair in life_bar_graph_raw.split(',') if pair
        )
github llllllllll / slider / slider / element_wise.py View on Github external
----------
    lhs, rhs : ElementWise or scalar
        The objects to broadcast together.

    Returns
    -------
    lhs, rhs : ElementWise
        The broadcasted operands.

    Raises
    -------
    ValueError
        Raised when the operands cannot be broadcasted together.
    """
    if not isinstance(lhs, ElementWise):
        lhs = ElementWise([lhs])
    if not isinstance(rhs, ElementWise):
        rhs = ElementWise([rhs])

    if len(lhs) == len(rhs):
        return lhs, rhs

    if len(lhs) == 1:
        return ElementWise([lhs._elements[0]] * len(rhs)), rhs

    if len(rhs) == 1:
        return lhs, ElementWise([rhs._elements[0]] * len(lhs))

    raise bad_broadcast(lhs, rhs)
github llllllllll / slider / slider / element_wise.py View on Github external
The objects to broadcast together.

    Returns
    -------
    lhs, rhs : ElementWise
        The broadcasted operands.

    Raises
    -------
    ValueError
        Raised when the operands cannot be broadcasted together.
    """
    if not isinstance(lhs, ElementWise):
        lhs = ElementWise([lhs])
    if not isinstance(rhs, ElementWise):
        rhs = ElementWise([rhs])

    if len(lhs) == len(rhs):
        return lhs, rhs

    if len(lhs) == 1:
        return ElementWise([lhs._elements[0]] * len(rhs)), rhs

    if len(rhs) == 1:
        return lhs, ElementWise([rhs._elements[0]] * len(lhs))

    raise bad_broadcast(lhs, rhs)
github llllllllll / slider / slider / element_wise.py View on Github external
def op(self, other):
        if (not isinstance(self, ElementWise) and
                not isinstance(other, ElementWise)):
                return operator(self, other)

        return ElementWise(list(map(operator, *broadcast(self, other))))
    op.__doc__ = doc