zarocknz / javascript-winwheel

Create spinning prize wheels on HTML canvas with Winwheel.js
http://dougtesting.net
MIT License
524 stars 362 forks source link

I want draw segmentImage without margin between each segements. #125

Open JKwang00 opened 1 year ago

JKwang00 commented 1 year ago

hello :) I love this. but i have some issue. i need help. i want image segments without margin because i already use different background color each segment images. so i no need margin. but i can't find any property.

i use lineWidth but nothing change.

have a nice day! let theWheel = new Winwheel({ 'canvasId': 'rolutte', 'numSegments' : 7, // Specify number of segments. 'lineWidth' : 0, 'strokeStyle': 'red', 'outerRadius' : 400, // Set outer radius so wheel fits inside the background. 'drawText' : true, // Code drawn text can be used with segment images. 'segmentStrokeWidth' : 0, 'textFontSize' : 0, 'textOrientation' : 'curved', 'textAlignment' : 'inner', 'textMargin' : 90, 'textFontFamily' : 'monospace', 'textStrokeStyle' : 'black', 'textLineWidth' : 3, 'textFillStyle' : 'white', 'drawMode' : 'segmentImage', // Must be segmentImage to draw wheel using one image per segemnt. 'segments' : // Define segments including image and text. [ {'lineWidth':0,'image' : '/img/roulette/chunk1.png', 'text' : 'Jane'}, {'lineWidth':0,'image' : '/img/roulette/chunk2.png', 'text' : 'Tom'}, {'lineWidth':0,'image' : '/img/roulette/chunk3.png', 'text' : 'Mary'}, {'lineWidth':0,'image' : '/img/roulette/chunk4.png', 'text' : 'Alex'}, {'lineWidth':0,'image' : '/img/roulette/chunk5.png', 'text' : 'Sarah'}, {'lineWidth':0,'image' : '/img/roulette/chunk6.png', 'text' : 'Bruce'}, {'lineWidth':0,'image' : '/img/roulette/chunk7.png', 'text' : 'steeve'} ], 'animation' : // Specify the animation to use. { 'type' : 'spinToStop', 'duration' : 5, // Duration in seconds. 'spins' : 8, // Number of complete spins. 'callbackFinished' : alertPrize } });

cantdocpp commented 1 year ago

If you're using an image wheel. i suggest that stop using image per segment like that. Just use the whole wheel with all its segments, I've tried that and got no problem with it.

You just have to make sure that the combined segment image start between the start and the end.

If you're still not understand, you can see the docs: http://dougtesting.net/winwheel/docs/tut9_creating_with_an_image even the author is using the whole image segment as the background and not using it as background image per segment

JKwang00 commented 1 year ago

@cantdocpp Thank you for reply. i just want to know how can i remove margin each image segments.