Search the Community
Showing results for tags 'canvas; draggable;'.
So I started creating my own tumbler effect using canvas. I have the rendering down perfect, but I needed to add the interactivity. Essentially I draw an SVG of numbers into a canvas element to use as a sprite sheet. I then blit the numerals onto the display depending on where I need them. Works very fast! I then started writing my own events for touch dragging and throwing but kind of got stuck coming up with snapping to a specific target point. I then remembered Greensock had a plugin for such a thing! But the problem is that it is based on physical elements... not applying the effect to a generic object. I wonder if there is someway to hack Draggable to make use of it for things other than elements. Basically just use it to tween a value instead? The only way I can think of is by creating some transparent div to throw. Or perhaps there is a better way to just find out how to calculate and adjust the target based on the velocity of the object.