preface

The articles

  • Canvas – Basics
  • Canvas advanced image processing basics

This article will explain the application of Canvas in the lottery

The Wheel of Fortune

The code address

The MAC

material

Why does the turntable have two almost identical pictures

  • When canvas each frame draw, alternate pictures to achieve flashing effect

Methods a

  • The simple way is to know the result of the lottery before the lottery starts, so that when the program runs, it is clear where it will end up, and we can use tween.js to implement the algorithm of the motion trajectory

  • The code address

Way 2

  • When the result of the lottery is unknown, you can draw, let the lottery run, and then force the program to tell the result of the lottery, so that the program itself slowly stop in the corresponding position

  • The code address