xxxxxxxxxx
// Version(1/22/2023) Feel free to copy and paste without giving credit. I'm not joking it's fine!
// More settings are below athleteData. These could be of interest if you want to customize the leaderboard.
// Custom elimination statuses (elim): 0=not eliminated, 1=eliminated from the start, 2=eliminated but then not eliminated, 3=not eliminated but then eliminated
// IMPORTANT: If an image fails to load, try copying the image (not the link) to https://onlineimagetools.com/convert-image-to-data-uri and pasting the output URL here. It'll take longer to load it and it's extremely slow to delete due to there being thousands or millions of characters, but this is the best way to fix this right now.
// An alternative link that outputs much shorter data URLs for large images but reduces quality, which is much easier to handle: https://onlineimagetools.com/resize-image?chain=convert-image-to-data-uri&width=128&height=128&ratio=false
// You could even upload the images to one of your sketches and copy the uploaded image's URL there, but this can take up space from your data storage plan.
// If you want to migrate score data from another leaderboard sketch's array system to this sketch's new array system, visit https://openprocessing.org/sketch/1441540
var athleteData = [
{name:"Black", r:40, g:40, b:40, elim:0, image:"", start:14, end:18},
{name:"Red", r:255, g:0, b:0, elim:0, image:"", start:0, end:0},
{name:"Orange", r:255, g:120, b:0, elim:0, image:"", start:13, end:33},
{name:"Yellow", r:255, g:255, b:0, elim:0, image:"", start:130, end:330},
{name:"Lime", r:0, g:255, b:0, elim:0, image:"", start:23, end:34},
{name:"Green", r:0, g:120, b:0, elim:0, image:"", start:145, end:286},
{name:"Blue", r:0, g:120, b:255, elim:0, image:"", start:71, end:150},
{name:"Sky", r:0, g:192, b:255, elim:0, image:"", start:52, end:111},
{name:"Purple", r:120, g:0, b:255, elim:0, image:"", start:114, end:154},
{name:"Pink", r:255, g:128, b:255, elim:0, image:"", start:34, end:50},
{name:"White", r:255, g:255, b:255, elim:0, image:"", start:96, end:104},
{name:"Gray", r:120, g:120, b:120, elim:0, image:"", start:9, end:9},
]
var players = athleteData.length // if you make this higher, you should add more athletes to the top. When using the legacy array system, change this to names.length for best results
var useAddPoints = false // Amount of points added beforehand.
var sortFirst = false // If true, athleteData will be sorted by start values before starting the sketch to make the bar layering less predictable, thus the athlete with lowest points will be in the front, and vice versa. This does not work when using the legacy array system.
var eliminatedAthletes = 2 // Prior to points being added, this many athletes with the lowest points are eliminated (This overrides any custom elimination statuses)
var eliminationCount = 1 // After points were added, this many athletes with the lowest points will be eliminated, as long as they haven't been eliminated already (This overrides any custom elimination statuses)
var eliminatedText = " ELIMINATED" // This is the text that is shown when a athlete is eliminated. Try adding spaces to the beginning if it is too close to the athlete name.
var creditText = "" // Credit the original creator, EliK! If you'd still like to modify this, I guess you could do so. Leave blank to disable.
var creditTextSize = 11 // Credit's text size
var textStrokeSize = 0 // Stroke/outline size for text. Set this to 0 to disable.
var creditTextStroke = false // If true, creditText will also have the stroke/outline
var waitSecs = 3 // This is how many seconds until the movement starts
var moveTime = 4 // This is how many seconds the movement of adding points will last
var moveEasing = "LINEAR" // Change the way the athletes' points are added. This can normally be LINEAR, SINE, QUAD, CUBIC, QUART, QUINT, EXPO, CIRC, BACK, ELASTIC, or BOUNCE, with dash-separated modifiers IN, OUT, and INOUT. (Example: "QUINT-IN" will return quintic easing that gets faster over time.) Leave blank to set it to LINEAR sorting movement.
var sortDelay = 0.5 // This is how many seconds it takes between adding points and sorting athletes
var sortTime = 2.25 // This is how many seconds it takes to move athletes, sorting them by points
var sortEasing = "SINE" // Change the way the athletes are sorted. Similar to moveEasing.
var eliminationWaitSecs = 0.75 // This is how many seconds until athletes get eliminated after movements finish
var eliminatedTextFadeSecs = 0.5 // How many seconds it takes for the eliminated text to fade when appearing. Set to 0 to disable and make it instantly appear.
var eliminatedTextFadeEasing = "LINEAR" // Change the way the eliminated text fades. Similar to moveEasing and sortEasing.
var backgroundColor = {r:0,g:0,b:0} // Background color. Setting the transparency effect (a) lower than the default 255 could give a cool effect!
var backgroundImage = "" // Background image. This will be used instead of the background color if this is defined.
var sidebarColor = {r:255,g:255,b:255,a:80} // Sidebar color. Default value with black background is {r:80,g:80,b:80}
var sidebarTextColor = {r:255,g:255,b:255} // Sidebar's text color
var scoreTextColor = {r:0,g:0,b:0} // Color of scores inside athlete's scorebars. Try to make sure the text is at least somewhat visible for every athlete. If this is set to "SAME" it will use the same color as the scorebar
var textStrokeColor = {r:0,g:0,b:0} // Stroke/outline color for text.
var eliminatedTextColor = {r:255,g:0,b:0} // Eliminated text color. If this is set to "SAME" it will use the same color as the scorebar
var eliminatedWindowColor = {r:255,g:0,b:0,a:128} // Color of the windows that cover the scorebars of eliminated athletes. Set the a value to 0 to disable.
var creditTextColor = {r:255,g:255,b:255} // Credit's text color
var sidebarWidth = 215 // Sidebar width
var scorebarWidth = 0 // Additional athlete's scorebar width. Assuming points are 0, this is the exact width.
var scorebarEndWidth = 0.672 // This value multiplied by the sketch width, will be the width of the scorebar with the highest score at the end of point adding.
var scorebarHeight = 0.875 // Scorebar height multiplier. If this is 1, then there will be no spacing between scorebars. It's recommended to set this to 1 if there are 30 or more players.
var scorebarTextSize = 1 // Text size multiplier for player names, scores and eliminated text
var scorebarInFront = true // If true, athlete's names, scorebars, and points numbers will go in front of the sidebar. It's not recommended to set this to false while nameSide is 0.
var scorebarImageMode = 1 // 0: Image stretches to entire scorebar, 1: Image shown at the start of scorebar, will be stretched if the scorebar is too short
var scorebarCornerRoundness = 0 // Change how round the end corners of scorebars are. This is not supported for images in scorebarImageMode 0 unfortunately...
var starBackground = false // Add stars into the background for decoration.
var starCount = 60 // Number of background stars
var starColor = {r:255,g:255,b:255} // Background star color
var starSize = 1 // Background star size multiplier
var starDirection = 1 // -1: Stars go left, 0: Stars are static, 1: Stars go right
var showRanks = true // If true, show text displaying ranks on the sidebar.
var showPoints = true // If true, show athlete points.
var showNames = true // If true, show athlete names.
var nameSide = 1 // The side which athlete names are shown. 0 = sidebar, 1 = next to scorebar (0 may need modifications, try increasing sidebarWidth and lowering sidebarTextMoveX in that case.)
var scoreSide = 0 // The side which athlete scores are shown. 0 = inside scorebar, 1 = next to scorebar
var commaPoints = true // If true, add commas to point numbers.
var commaThreshold = 3 // If commaPoints is true, this determines which power of 10 will start adding commas to points. 6 = 1 million, 15 = 1 quadrillion. Set this to 3 (1,000) if unsure.
var shortenPoints = false // If true, shorten point numbers whenever the number reaches 10^shortenThreshold. For example, this turns 1,234,567 into 1.234M. (M stands for million)
var shortenThreshold = 99 // If shortenPoints is true, this determines which power of 10 will start shortening points. Set this to 6 (1 million) if unsure.
var shortenDecimals = 3 // number of decimal places for shortened numbers
var shortenStyle = 1 // Style for suffixes of shortened points. List: 1: Default, 2: Simplified, 3: NO! style, 4: NO! style simplified, 5: Exponent, 7: Full words... (There are 10 styles in all, go to the shortenStyles tab to see them all)
var shortenSeparator = " " // This is the string that separates the shortened numbers between the number and the suffix. Example: Value "sep" = 1.234sepM for 1,234,567
var pointDisplayType = "" // Change how points are shown. ROUND rounds decimals to the nearest whole number (5.25 to 5, 5.75 to 6), FLOOR rounds down (5.75 to 5), CEIL rounds up (5.25 to 6), and DECIMAL preserves the decimals (5.25 stays the same). Leave blank to set it to ROUND.
var pointPrefix = "" // Add a prefix that will show before the point numbers
var pointPrefixSingular = "" // Singular version of pointsPrefix, for 1 point
var pointSuffix = "" // Add a suffix that will show after the point numbers
var pointSuffixSingular = "" // Singular version of pointsSuffix, for 1 point
var beginSound = "" // If you want to play a sound when the sketch begins, add the url here. Leave blank to disable.
var beginSoundMode = 4 // 0: Play once, 1: Loop until point adding, 2: Loop until sorting, 3: Loop until elimination, 4: Loop forever, like background music
var moveSound = "https://deckard.openprocessing.org/user280519/visual1360213/h7c9e2587bd3f8e21ad45f0cb010abcb3/Score%20Sound.mp3" // If you want to play a sound while the points are being added, add the url here. Leave blank to disable.
var moveSoundMode = 2 // 0: Play once, 1: Play once and stop at the end of point adding, 2: Loop throughout point adding and stop at the end
var moveSoundPrevent = true // If true, then moveSound will not be played if no score changes are made
var sortSound = "" // Sound played when sorting players
var sortSoundMode = 0 // 0: Play once, 1: Play once and stop at the end of sorting, 2: Loop throughout sorting and stop at the end
var elimSound = "" // Sound played when players get eliminated. Plays once.
var font = "Helvetica" // Change your font here. Leave blank if you don't want a font.
var fontStyle = "NORMAL" // Font style. This can normally be NORMAL, BOLD, ITALIC, or BOLDITALIC. Leave blank to set it to NORMAL.
var eliminatedFont = "IMPACT" // Alternate font used for eliminated athlete text. Leave blank if you don't want a font. Set this to font, "SAME", or "INHERIT" to use the first font instead.
var eliminatedFontStyle = "NORMAL" // Font style for eliminated athlete text font. This can normally be NORMAL, BOLD, ITALIC, or BOLDITALIC. Leave blank to set it to NORMAL. Set this to fontStyle, "SAME", or "INHERIT" to use fontStyle instead.
var creditFont = "SAME" // Alternate font used for credit text. Leave blank if you don't want a font. Set this to font, "SAME", or "INHERIT" to use the first font instead.
var creditFontStyle = "SAME" // Font style for credit text font. This can normally be NORMAL, BOLD, ITALIC, or BOLDITALIC. Leave blank to set it to NORMAL. Set this to fontStyle, "SAME", or "INHERIT" to use fontStyle instead.
var sidebarTextAlign = "RIGHT" // Text alignment for sidebar text. This can normally be LEFT, CENTER, or RIGHT. Leave blank to set it to CENTER.
var textMoveX = -5 // Move all text by this much in horizontal axis. Try changing this if the text cuts off near the end.
var textMoveY = 3 // Move all text by this much in vertical axis. Try changing this is the text is mostly off-center.
var sidebarTextMoveX = 40 // Move all sidebar text by this much in horizontal axis simultaneously with textMoveX. Try changing this is the text is mostly off-center.
var sidebarTextMoveY = 0 // Move all sidebar text by this much in vertical axis simultaneously with textMoveY. Try changing this is the text is mostly off-center.
var creditTextMoveX = 1 // Move credit text by this much in horizontal axis. Try changing this if the text cuts off near the end.
var creditTextMoveY = 1 // Move credit text by this much in vertical axis.
var fps = 57 // Frames Per Second.
var windowWidthMultiplier = 1 // Multiply regular window width by this value.
var windowHeightMultiplier = 1 // Multiply regular window height by this value.
// Legacy array system starts here.
// This system is harder to edit due to all the athlete data being lumped together, making it harder to find a specific one's score. This system also does not support images or custom elimination statuses.
var useLegacy = false // If you want to use the legacy array system, set this to true. Optionally you can move all lines inbetween the legacy array system comments to the top.
var names = ["Maroon","Red","Brown","Orange","Olive","Yellow","Lime","Dark Green","Green","cyan","Navy","Blue","Purple","Magenta","Pink","Black","Coal","Gray","Silver","White"]
var colors = [{r:128,g:0,b:0},{r:255,g:0,b:0},{r:128,g:63,b:0},{r:255,g:128,b:0},{r:128,g:128,b:0},{r:255,g:255,b:0},{r:191,g:255,b:0},{r:0,g:128,b:0},{r:0,g:255,b:0},{r:0,g:255,b:255},{r:0,g:0,b:128},{r:0,g:0,b:255},{r:128,g:0,b:255},{r:255,g:0,b:255},{r:255,g:128,b:255},{r:48,g:48,b:48},{r:63,g:63,b:63},{r:128,g:128,b:128},{r:191,g:191,b:191},{r:255,g:255,b:255}]
var startingPoints = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
var endingPoints = [13483,3,1976,14970,4131,20803,100,37518,2815,60,108,54,15633,48521,119,1946,59,78,17243,5456]
//var endingPoints = "random1024"
var addPoints = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
// Legacy array system ends here.