8.1.3 โ€ข Published 2 years ago

creepyface-dance v8.1.3

Weekly downloads
203
License
MIT
Repository
github
Last release
2 years ago

Creepyface Dance ๐Ÿ’ƒ ยท npm version

A point provider for Creepyface to make your face dance.

Usage

<script src="https://creepyface.io/creepyface.js"></script>
<script src="https://unpkg.com/creepyface-dance"></script>
<img
  data-creepyface
  data-points="bensound-buddy"
  src="https://creepyface.io/img/0/serious"
  data-src-hover="https://creepyface.io/img/0/hover"
  data-src-look-0="https://creepyface.io/img/0/0"
  data-src-look-45="https://creepyface.io/img/0/45"
  data-src-look-90="https://creepyface.io/img/0/90"
  data-src-look-135="https://creepyface.io/img/0/135"
  data-src-look-180="https://creepyface.io/img/0/180"
  data-src-look-225="https://creepyface.io/img/0/225"
  data-src-look-270="https://creepyface.io/img/0/270"
  data-src-look-315="https://creepyface.io/img/0/315"
/>
<audio
  src="https://www.bensound.com/bensound-music/bensound-buddy.mp3"
  controls
></audio>
<script>
  const { repeat, circle } = creepyfaceDance.moves
  creepyfaceDance.makePointProvider({
    name: 'bensound-buddy',
    audio: document.querySelector('audio'),
    bpm: 150,
    firstBeat: 0,
    choreography: repeat(4)([
      ...repeat(20)(['w', 'e', 'n', 's']),
      ...repeat(20)(['nw', 'ne', 'sw', 'se']),
      ...repeat(20)(circle('n')),
      ...repeat(20)(circle('s', true)),
    ]),
  })
</script>

Run this example on codepen.

makePointProvider parameters

NameDescription
nameThe name for the point provider to be created. This will be used for the data-creepyface attribute of your image.
audioThe HTMLAudioElement with the song. Since browsers now block autoplaying media you will have to manually play the audio or call the play method in response to a user event.
bpmThe number of beats per minute of your song. You can use this to calculate it.
firstBeatThe time (in seconds) when the first beat happens in your song. This is when the first step of your choreography will be performed.
choreographyThe array of steps to perform on each beat. Valid steps are: n, ne, e, se, s, sw, w, nw, serious and crazy.

Available moves

Moves are functions that return an array of steps. CreepyfaceDance provides some of them out of the box:

NameDescriptionExample
repeatRepeats the given sequence a specified amouht of times.repeat(10)(['s', 'n'])
circleAn 8 step move describing a counterclockwise circle looking to every direction from the one provided.circle('e')
intercalateConstructs a secuence consisting of the itercalation of a given sequence and a step.intercalate(['n', 'w'], 'crazy')

You can build you own moves too!

Developing

  • yarn dev will spin up a test page.
  • yarn build will generate the production scripts under the dist folder.
8.2.0-alpha.0

2 years ago

8.2.0-alpha.1

2 years ago

8.1.3

3 years ago

8.1.2

3 years ago

8.1.1

3 years ago

8.1.0

3 years ago

8.0.3-alpha.0

3 years ago

8.0.2

3 years ago

8.0.1

3 years ago

8.0.0

3 years ago

8.0.0-alpha.2

3 years ago

7.5.1

3 years ago

8.0.0-alpha.1

3 years ago

8.0.0-alpha.0

3 years ago

7.5.0

3 years ago

7.4.8

3 years ago

7.4.7

3 years ago

7.4.6

3 years ago

7.4.5

3 years ago

7.4.4

4 years ago

7.4.2

4 years ago

7.4.1

4 years ago

7.3.10

4 years ago

7.3.7

4 years ago

7.3.6

4 years ago

7.3.5

4 years ago

7.3.4

4 years ago

7.3.3

4 years ago

7.3.2

4 years ago