Programming our keyframes 

So based on the information we've been given, the values we need for each keyframe are:

  • servoOne null, servoTwo null (start wherever the servos happen to be)
  • servoOne 0, servoTwo 180
  • servoOne 180, servoTwo null (servoTwo starts moving towards 90 degrees)
  • servoOne false, servoTwo null (servoOne stays put, servoTwo still moving to 90 degrees)
  • servoOne 90, servoTwo 90

Each position needs to be an object with a property degrees for each keyframe. Let's translate that into JavaScript, right under the construction of our animation object:

let keyframes = [
[null, {degrees: 0}, {degrees: 180}, false, {degrees:90}], // servoOne
[null, {degrees: 180}, null, null, {degrees: 90}] // servoTwo
]

Now that we have our keyframes programmed, let's get started on our cue points.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.134.130