Link to the working version Raffle Spinner Link
Firefox works best for all data set sizes and duration.
Chrome has issues animating names with large sets (1500+ rows) and short duration (8 seconds or less). Increase duration for proper animation.
Test data is available to download in the project folder. Text/image safezones for a custom background are also in the folder as well as the photoshop file. (1920x1080)
A Pen created on CodePen.io. Original URL: https://codepen.io/donconn3/pen/ZEqXKEJ.
Vertiaclly-scrolling list that has the appearance of fading in and out.
The source for the animation was from a PEN on CodePen(wish I could find it again).
Uses read-excel-file.js, write-excel-file.js, Boostrap 5.3; written mostly in vanilla JS, HTML, and CSS.
- Upload an excel file (.xls or .xlsx)
- Add Title
- Set raffle duration
- Change background/gradient
- Pick name
- Download Winner(s)
- The file format must be .xls or .xlsx
- ONLY Column 1 and Column 2 of the excel sheet is displayed (firstName lastName) but column 3 is also read
- Empty Cells throw an error so make sure Col 1, Col 2, and Col 3 are all filled
- Col 3 can be any information you want (phone, email, raffle #, ticket #, etc.)
- The program has worked with over 28,000 rows with 2 columns & over 14,000 rows with 3 columns
- Upload your file
- Change the name of the raffle and the duration
- Click the checkbox if you want to exclude winners from each drawing or keep them in each time
- Click "Pick Name" (winner is the last person in the 'players' array created below. Winner(s) is logged to the console and in localStorage)
- Once the names stop scrolling, you will have your winner
- To draw another name, click "New Drawing" and then repeat Step 4
- To download the Winner information, click hamburger icon and then click "Download Winners".
- This will download an excel sheet to your computer with the: DATE+TIME each winner was picked, NAME of the winner(s) and the - phone, email, raffle #, ticket #, etc.- of winner(s)
- i) DO NOT CLICK "DELETE DRAWING" BEFORE YOU CLICK "DOWNLOAD WINNERS" OR ALL WINNER INFORMATION WILL BE LOST!
- ii) To start a new drawing with a new list, Complete Step 5, then hit click "Delete Drawing", and then repeat from Step 1
- The "readexcelfile" reads each row making an array-of-arrays (sheet = main array, each row = sub-array)
- A "player" is created and assigned a random number which indicates their index position in the array
- While the "counter" is less than the number of rows, the new "player" is checked against an exclusion array that checks to see if the new "player" has been picked already
- If the "player" has been picked, then the loop restarts
- If the "player" has NOT been picked, then a "person" is created using the "player" index and added to the "players" array and the "counter" goes up by 1
- Once the "players" array is finished, a for-loop creates a
- tag for each "person"
- When the "Pick Name" button is clicked, the list of names is scrolled until the "winner" (last
- tag) appears
- When the "New Drawing" button is clicked, the "players" and "exclusions" arrays are emptied, and the internal "counter" is reset to 0
- add carusel of images to show potential prizes ✅
- collapsible menu sections
- tips/instructions at the bottom of each section for instruction
- select which columns to read from
- write in names instead of uploading a file
- download winners as a pdf/.doc as wells as spreadsheet
- Far down the road: profiles/layouts, more control over text/font/colors