相关疑难解决方法(0)

Javascript摇html元素

我正试图为我的游戏摇动一个html元素.

我在这里找到了这段代码:

shake = function (sprite, magnitude = 16, angular = false) {

  //A counter to count the number of shakes
  var counter = 1;

  //The total number of shakes (there will be 1 shake per frame)
  var numberOfShakes = 10;

  //Capture the sprite's position and angle so you can
  //restore them after the shaking has finished
  var startX = sprite.x,
      startY = sprite.y,
      startAngle = sprite.rotation;

  // Divide the magnitude into 10 units so that you can 
  // reduce …
Run Code Online (Sandbox Code Playgroud)

html javascript css-animations

6
推荐指数
3
解决办法
6274
查看次数

标签 统计

css-animations ×1

html ×1

javascript ×1