Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # FOUR STAGE VALUE SWING
- # This code make "out" vary from max..0..-max..0 to create a 4 stage swing of values
- # The current timer is stored onto "@s"
- #
- # @s = timer counting from 0 to 4*max
- # in = maximum rotation / sequence number (max)
- # in1 = speed of sequencer
- # out = swing value to use
- ## timeline (t) cycling
- scoreboard players operation #temp animation_4stage = in animation_4stage
- scoreboard players operation #temp animation_4stage *= #4 constant
- scoreboard players operation @s animation_4stage += in1 animation_4stage
- execute if score @s animation_4stage >= #temp animation_4stage run scoreboard players set @s animation_4stage 0
- ## rotation calculations
- # get motion sequence
- scoreboard players operation #seq animation_4stage = @s animation_4stage
- scoreboard players operation #seq animation_4stage /= in animation_4stage
- # (t % in)
- scoreboard players operation #temp1 animation_4stage = @s animation_4stage
- scoreboard players operation #temp1 animation_4stage %= in animation_4stage
- ## Sequence Output Calculation
- # seq = 0: 0 to max
- # seq = 1: max to 0
- # seq = 2: 0 to -max
- # seq = 3: -max to 0
- # if seq = 1, 15 - (t % in)
- execute if score #seq animation_4stage matches 1 run scoreboard players operation #temp1 animation_4stage -= in animation_4stage
- execute if score #seq animation_4stage matches 1 run scoreboard players operation #temp1 animation_4stage *= #-1 constant
- # if seq = 2, - (t % in)
- execute if score #seq animation_4stage matches 2 run scoreboard players operation #temp1 animation_4stage *= #-1 constant
- # if seq = 3, - (t % in)
- execute if score #seq animation_4stage matches 3 run scoreboard players operation #temp1 animation_4stage -= in animation_4stage
- scoreboard players operation out animation_4stage = #temp1 animation_4stage
Advertisement
Add Comment
Please, Sign In to add comment