Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                svg.backdrop(xmlns='http://www.w3.org/2000/svg' viewBox='0 0 508 286')
  g(transform='translate(0 -11)')
    path(d='M508 98c-38 4-82 62-124 61-50 0-91-53-141-53-50-1-93 52-143 52-34 0-68-36-100-52v144h508V98z')
    path(d='M508 147c-71 5-157 57-230 67-97 12-157 20-278 31v40h508V147z')
    circle(cx='33.1' cy='91.7' r='24.6')
    circle(cx='68.4' cy='56.5' r='10.7')

.mando__container
  svg.mando(xmlns='http://www.w3.org/2000/svg' viewBox='0 0 122.56 186.86')
    g
      g.jetpack(transform='rotate(13.2 423.46 260.76)')
        g.mandalorian__flames
          g.mandalorian__jets(transform='matrix(1.00005 .009 .00435 1.23105 3.63 -10.17)')
            rect(width='3.21' height='36.66' x='23.06' y='173.97' ry='0')
            rect(ry='0' y='173.97' x='24.8' height='36.66' width='3.21')
            rect(ry='0' y='173.97' x='26.55' height='36.66' width='3.21')
            rect(width='3.21' height='36.66' x='28.3' y='173.97' ry='0')
            rect(ry='0' y='173.97' x='30.05' height='36.66' width='1.98')
          g.mandalorian__jet-bubbles(transform='translate(5.26 37.53)')
            //- ellipse(cy='207.33' cx='26.27' rx='4.72' ry='4.63')
            circle.mando__jet-blast(cx='23.53' cy='210.16' r='3.59')
            circle.mando__jet-blast(r='3.87' cy='209.12' cx='29.86')
            circle.mando__jet-blast(cx='25.51' cy='212.71' r='3.59')
            circle.mando__jet-blast(r='3.59' cy='211.58' cx='31.37')
            circle.mando__jet-blast(cx='22.4' cy='212.43' r='3.59')
            circle.mando__jet-blast(r='3.87' cy='209.12' cx='29.86')
            circle.mando__jet-blast(cx='25.51' cy='212.71' r='3.59')
            circle.mando__jet-blast(r='3.59' cy='211.58' cx='31.37')
            circle.mando__jet-blast(cx='22.4' cy='212.43' r='3.59')
            //- circle.mando__jet-blast(r='22.03' cy='212.43' cx='22.4')
        path.mandalorian__jetpack-pipe(d='M31.13 191.35h2.65l3.17 12.85H26.9l4.23-12.85z' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        g.mandalorian__flames
          g.mandalorian__jets(transform='matrix(1.00005 .009 .00435 1.23105 -10.27 -10.09)')
            rect(ry='0' y='173.97' x='23.06' height='36.66' width='3.21')
            rect(width='3.21' height='36.66' x='24.8' y='173.97' ry='0')
            rect(width='3.21' height='36.66' x='26.55' y='173.97' ry='0')
            rect(ry='0' y='173.97' x='28.3' height='36.66' width='3.21')
            rect(width='1.98' height='36.66' x='30.05' y='173.97' ry='0')
          g.mandalorian__jet-bubbles(transform='translate(-8.64 37.61)')
            //- ellipse(ry='4.63' rx='4.72' cx='26.27' cy='207.33')
            circle.mando__jet-blast(r='3.59' cy='210.16' cx='23.53')
            circle.mando__jet-blast(cx='29.86' cy='209.12' r='3.87')
            circle.mando__jet-blast(r='3.59' cy='212.71' cx='25.51')
            circle.mando__jet-blast(cx='31.37' cy='211.58' r='3.59')
            circle.mando__jet-blast(r='3.59' cy='212.43' cx='22.4')
            circle.mando__jet-blast(r='3.59' cy='212.71' cx='25.51')
            circle.mando__jet-blast(cx='31.37' cy='211.58' r='3.59')
            circle.mando__jet-blast(r='3.59' cy='212.43' cx='22.4')
            circle.mando__jet-blast(r='3.59' cy='212.43' cx='22.4')
            //- circle.mando__jet-blast(cx='22.4' cy='212.43' r='22.03')
          path.mandalorian__jetpack-pipe(d='M17.24 191.43h2.64l3.18 12.86H13l4.24-12.86z' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        rect.mandalorian__jetpack(width='28.01' height='34.44' x='15.1' y='162.04' ry='2.76' fill='#999' stroke='#000' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
      g.mandalorian__leg(transform='translate(36.5 -57.14)' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        ellipse(cx='-28.2' cy='190.88' rx='5.75' ry='8.15' transform='rotate(-19.79)' fill='#502d16')
        path(fill='#803300' d='M38.09 166.72l9.85 2.71-5.05 18.36-9.86-2.71z')
        path(fill='#e6e6e6' d='M35.77 171.24l11.86 3.26-2.41 8.78L33.35 180z')
      g.mandalorian__leg(transform='translate(19.4 -57.14)' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        ellipse(transform='rotate(-19.79)' ry='8.15' rx='5.75' cy='190.88' cx='-28.2' fill='#502d16')
        path(fill='#803300' d='M38.09 166.72l9.85 2.71-5.05 18.36-9.86-2.71z')
        path(fill='#e6e6e6' d='M35.77 171.24l11.86 3.26-2.41 8.78L33.35 180z')
      g.mando__left-arm
        path(fill='#4d4d4d' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round' d='M90.16 77.18L80.02 85.2l12.47 15.78 10.14-8.02z')
        path(d='M84 73.02a10.2 13.6-44.67 0111.4 4.85 10.2 13.6-44.67 013.02 4.1L82.13 93.37a10.2 13.6-44.67 01-1.25-1.14 10.2 13.6-44.67 01-2.3-16.85A10.2 13.6-44.67 0184 73.02z' fill='#520' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        g.mandalorian__glove(transform='rotate(-36.87 -29.53 38.86)')
          path(stroke-width='2.41' stroke-linecap='round' stroke-linejoin='round' d='M29.36 156.46h16.11v7.99H29.36z')
          path(d='M34.24 156.4v7.74M40.6 156.58v7.94' fill='none' stroke-width='1.32')
          ellipse(ry='3.31' rx='3.4' cy='167.26' cx='47.06' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
          rect(ry='4.14' y='163.98' x='28' height='12.41' width='18.84' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
      path.mandalorian__torso(stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M53.18 72.76H84.7v38.32H53.18z')
      g.mandalorian__ammo-sash(stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        path(d='M60.5 108.98a15.15 22.31 40.87 0017.56-9.64 15.15 22.31 40.87 003.15-26.79 15.15 22.31 40.87 00-3.37-1.94 15.15 22.31 40.87 01-6.67 20.74 15.15 22.31 40.87 01-22.69 8.9A15.15 22.31 40.87 0052 106.3a15.15 22.31 40.87 008.5 2.68z')
        path(d='M54.15 100.2l5.13-2.4 6.09 13-5.13 2.4zM68.74 90.76l4.6-3.33 8.43 11.63-4.6 3.33zM61.62 97.11l4.63-3.27 8.28 11.73-4.63 3.27z')
      g.mandalorian__belt( stroke-linecap='round' stroke-linejoin='round')
        path(stroke-width='2.54' d='M50.93 107.14h36.01v6.91h-36z')
        path(stroke-width='2.65' d='M62.41 103.9h13.04v13.41H62.41z')
      g.mandalorian__helmet(transform='translate(-12.25 -57.7)')
        path(d='M79.37 64.05c-14.08 0-25.64 11.92-28.7 28.1-2.16 11.39-2.2 28.03-2.2 40.65l30.9 5.3h15.46l15.46-5.3c-.34-4.49-1.8-39.1-2.2-40.65-4.08-15.96-14.63-28.1-28.72-28.1z' stroke-width='2.420907' stroke-linecap='round' stroke-linejoin='round')
        path(d='M81.75 66.6c-14.08 0-25.65 11.91-28.7 28.1-2.16 11.38-2.21 28.02-2.21 40.65l.27.04c.05-12.66.37-27.7 2.6-38.4 3.47-16.67 16.23-29.12 31.99-30.07-1.28-.21-2.6-.32-3.95-.32z' )
        path(d='M80.98 64.11v35.27h12V68.32a23.98 23.98 0 00-12-4.21z' stroke-width='2.8230685999999996' stroke-linecap='round' stroke-linejoin='round')
        path(d='M51.35 89.11c-.26 1-.49 2.01-.69 3.04-2.15 11.39-2.2 28.03-2.2 40.65l30.91 5.3h15.46l15.46-5.3c-.34-4.49-1.8-39.1-2.2-40.65a55.13 55.13 0 00-.87-3.04z' stroke-width='2.6458' stroke-linecap='round' stroke-linejoin='round')
        path(d='M50.69 92.04l-.03.11c-.32 1.74-.6 1.5-.84 3.45l30.93 2.11h12.3l15.46-2.11c-.18-3.07-.33-3.1-.42-3.45l-.03-.1z')
        path(d='M80.98 92.04h12v46.49h-12z')
        path(d='M49.85 97.49c-1.35 10.85-1.39 24.55-1.39 35.31l30.48 5.22v-14.34c0-14.4-14.58-26.09-29.1-26.2z')
        path(d='M49.04 103.8c-.56 8.83-.58 21.04-.58 29l30.51 5.23c-.2-13.02-14.41-28.34-22.98-31.6z' )
        path(d='M108.55 98.43c-8.07 3-14.06 13.93-14.06 26.97v12.7h.34l15.46-5.3c-.26-3.38-1.15-23.8-1.74-34.37z')
        path(d='M108.9 105.14c-6.95 5.27-14.22 21.84-14.22 32.83v.12h.15l15.46-5.29c-.2-2.75-.84-16.82-1.39-27.66z')
        path(d='M79.37 64.05c-14.08 0-25.64 11.92-28.7 28.1-2.16 11.39-2.2 28.03-2.2 40.65l30.9 5.3h15.46l15.46-5.3c-.34-4.49-1.8-39.1-2.2-40.65-4.08-15.96-14.63-28.1-28.72-28.1z' fill='none' stroke-width='2.420907' stroke-linecap='round' stroke-linejoin='round')
        path(d='M79.37 64.05c-14.08 0-25.64 11.92-28.7 28.1-2.16 11.39-2.2 28.03-2.2 40.65l30.9 5.3h15.46l15.46-5.3c-.34-4.49-1.8-39.1-2.2-40.65-4.08-15.96-14.63-28.1-28.72-28.1z' fill='none' stroke-width='2.420907' stroke-linecap='round' stroke-linejoin='round')
        path(stroke-width='2.42' stroke-linecap='round' stroke-linejoin='round' d='M44.2 94.44h11.63v39.22H44.2z')
        ellipse(cx='50.01' cy='94.26' rx='5.75' ry='7.28' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
        path(d='M44.22 116.14h7.18M44.22 124.6h7.18M44.22 120.37h7.18' fill='none' stroke-width='2.65')
        rect(ry='1.51' y='91.09' x='47.54' height='6.33' width='4.95')
      g.mando__right-arm
        g.blaster(transform='translate(134.3 -78.98)')
          circle(r='4.28' cy='150.8' cx='-51.85' fill='none' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
          path( stroke-width='.54' stroke-linecap='round' stroke-linejoin='round' d='M-43.18 133.41h3.44v6.12h-3.44z')
          path(d='M-65.17 140.52h12.64l-5.18 38.14-12.64-6.4z' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round')
          path(fill='#333'  stroke-width='2.55' stroke-linecap='round' stroke-linejoin='round' d='M-70.88 138.19h49.55v9.45h-49.55z')
          path( stroke-width='.54' stroke-linecap='round' stroke-linejoin='round' d='M-59.75 133.15h3.44v6.12h-3.44z')
          path(d='M-47.85 142.5h27.8v6.41h-27.8z')
          path(fill='none'  stroke-width='2.55' stroke-linecap='round' stroke-linejoin='round' d='M-70.88 138.19h49.55v9.45h-49.55z')
          path( stroke-width='1.11' stroke-linecap='round' stroke-linejoin='round' d='M-35.57 134.47h-30.94v-2.87h30.94z')
          rect(transform='scale(-1)' ry='1.95' y='-136.64' x='62.26' height='7.22' width='5.35')
          //- rect(ry='1.95' y='140.65' x='-64.41' height='4.28' width='40.09' fill='red')
        g.mandalorian__right-arm
          path(fill='#4d4d4d' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round' d='M48.55 88.08l.06-12.93 20.11.1-.06 12.92z')
          path(d='M41.49 85.8a13.6 10.2 6.6 0010.83 5.98 13.6 10.2 6.6 005.1-.15l-1.09-19.85a13.6 10.2 6.6 00-1.66-.28 13.6 10.2 6.6 00-14.7 8.57 13.6 10.2 6.6 001.52 5.73z' fill='#520' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
          g.mandalorian__glove(transform='rotate(-89.73 13.04 105.52)')
            path(stroke-width='2.41' stroke-linecap='round' stroke-linejoin='round' d='M29.36 156.46h16.11v7.99H29.36z')
            path(d='M34.24 156.4v7.74M40.6 156.58v7.94' fill='none' stroke-width='1.32')
            ellipse(ry='3.31' rx='3.4' cy='167.26' cx='47.06' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
            rect(ry='4.14' y='163.98' x='28' height='12.41' width='18.84' stroke-width='2.65' stroke-linecap='round' stroke-linejoin='round')
  .shots
    .shot
button Fly!

              
            
!

CSS

              
                *
  box-sizing border-box

:root
  --size 20
  --jetpack-silver hsl(0, 0%, 45%)
  --stroke hsl(0, 0%, 10%)
  --boot hsl(15, 100%, 10%)
  --clothing hsl(30, 80%, 20%)
  --armour hsl(0, 0%, 50%)
  --glove hsl(10, 20%, 20%)
  --dune-one hsl(30, 80%, 30%)
  --dune-two hsl(40, 60%, 50%)
  --sky-two hsl(215, 80%, 30%)
  --sky-one hsl(205, 100%, 80%)
  --sun-one hsl(45, 100%, 70%)
  --sun-two hsl(30, 100%, 90%)

body
  align-items center
  display flex
  min-height 100vh
  justify-content center
  overflow hidden
  background linear-gradient(0deg, var(--sky-one), var(--sky-two))

.mando
  width calc(var(--size) * 1vmin)

  &__container
    position absolute
    left 0
    top 100%

.blaster
  stroke var(--stroke)
  path:nth-of-type(2)
    fill var(--boot)
  path:nth-of-type(5)
    fill var(--armour)


.mandalorian__helmet
  path:nth-of-type(1)
    fill var(--armour)
    stroke var(--stroke)
  path:nth-of-type(2)
    fill hsla(0, 0%, 100%, 0.8)
  path:nth-of-type(3)
    fill var(--armour)
    stroke hsl(0, 0%, 30%)
  path:nth-of-type(4)
    fill var(--armour)
    stroke var(--stroke)
  path:nth-of-type(5)
  path:nth-of-type(6)
    fill hsl(0, 0%, 0%)
  path:nth-of-type(7)
  path:nth-of-type(9)
    fill hsl(0, 0%, 20%)
    stroke var(--stroke)
  path:nth-of-type(8)
  path:nth-of-type(10)
    fill hsl(0, 0%, 35%)
    stroke var(--stroke)
  path:nth-of-type(11)
    fill none
    stroke var(--stroke)
  path:nth-of-type(13)
    fill hsl(0, 0%, 30%)
    stroke var(--stroke)
  ellipse
    fill hsl(0, 0%, 15%)
    stroke none
  rect
    stroke var(--stroke)
    fill hsl(0, 0%, 75%)
.mandalorian__torso
  stroke var(--stroke)
  fill var(--clothing)

.mandalorian__ammo-sash
.mandalorian__belt
  stroke var(--stroke)
  path:nth-of-type(1)
    fill var(--boot)
  path:nth-of-type(2)
    fill var(--armour)


.mandalorian__jets rect
.mandalorian__jet-bubbles circle
  fill 'hsl(%s, %s, %s)' % (var(--hue) calc(var(--saturation) * 1%) calc(var(--lightness) * 1%))

.mandalorian__jetpack
.mandalorian__jetpack-pipe
  fill var(--jetpack-silver)
  stroke var(--stroke)

.mandalorian__leg
  stroke var(--stroke)

  ellipse
    fill var(--boot)

  path:nth-of-type(1)
    fill var(--clothing)

  path:nth-of-type(2)
    fill var(--armour)

.mando__left-arm
.mandalorian__right-arm
  stroke var(--stroke)

  & > path:nth-of-type(1)
    fill var(--clothing)

  & > path:nth-of-type(2)
    fill var(--armour)

.mandalorian__glove
  fill var(--glove)

.shot
  background red
  position absolute
  top 22%
  left 40%
  height 10%
  width 50%

.shots
  position absolute
  top 27%
  height 27%
  width 62%
  z-index 3
  transform-origin 10% 60%
  left 32%
  z-index -1

.backdrop
  width 100vw
  position absolute
  left 0
  transform translate(0%, 5vmax)
  bottom 0

  path:nth-of-type(1)
    fill var(--dune-one)
  path:nth-of-type(2)
    fill var(--dune-two)
  circle:nth-of-type(1)
    fill var(--sun-one)
  circle:nth-of-type(2)
    fill var(--sun-two)

button
  position fixed
  top 0
  left 0
  right 0
  bottom 0
  width 100vw
  height 100vh
  opacity 0
  -webkit-appearance none
  appearance none
              
            
!

JS

              
                const {
  gsap: { timeline, to, set },
} = window

const CONFIG = {
  SPEED: {
    LOWER: 5,
    UPPER: 8,
  },
}

const randomInRange = (min, max) =>
  Math.floor(Math.random() * (max - min + 1)) + min
const JETS = []
let TL
let killTimer

const BTN = document.querySelector('button')
const MANDO = document.querySelector('.mando__container')
const SHOT = document.querySelector('.shot')
const SHOTS = document.querySelector('.shots')
const RIGHT_ARM = document.querySelector('.mando__right-arm')
const LEFT_ARM = document.querySelector('.mando__left-arm')
const BLASTS = [...document.querySelectorAll('.mando__jet-blast')]

set(MANDO, {
  x: Math.random() * window.innerWidth,
})
set(LEFT_ARM, { rotate: 30, transformOrigin: '10% 10%' })
set([RIGHT_ARM, SHOTS], { rotate: 80, transformOrigin: '10% 60%' })
set(BLASTS, { transformOrigin: '50% 50%' })
set(MANDO, { transformOrigin: '50% 50%', rotate: 30 })
// set(SHOTS, { rotate: '+=30'})
const getFlightMechanics = () => {
  const { x: xCurrent } = MANDO.getBoundingClientRect()
  const RES = {}
  if (xCurrent > window.innerWidth / 2) {
    RES.flip = true
    RES.angle = randomInRange(-110, -90)
  } else {
    RES.flip = false
    RES.angle = randomInRange(-90, -70)
  }
  RES.duration = randomInRange(CONFIG.SPEED.LOWER, CONFIG.SPEED.UPPER)
  return RES
}

set(['.mandalorian__jet-bubbles circle', '.mandalorian__jets rect'], {
  '--hue': () => randomInRange(10, 60),
  '--saturation': () => randomInRange(70, 100),
  '--lightness': () => randomInRange(50, 90),
})

const killJets = () => {
  JETS.forEach(jet => jet.kill())
  JETS.length = 0
  set('.mandalorian__flames', { display: 'none' })
}
const startJets = () => {
  if (JETS.length) killJets()
  set('.mandalorian__flames', { display: 'block' })
  BLASTS.forEach(blast => {
    const TWEEN = to(blast, {
      duration: 'random(0.05, 0.3)',
      delay: () => -Math.random(),
      repeat: -1,
      yoyo: true,
      transformOrigin: '50% 50%',
      scale: 'random(1, 6)',
    })
    JETS.push(TWEEN)
  })
}

const onTakeOff = duration => {
  // Reset the shots
  set(SHOT, { x: 0, opacity: 1 })
  // Disable the button to prevent spamming it
  BTN.setAttribute('disabled', true)
  // Start rockets
  zzfx(
    ...[
      ,
      ,
      819,
      duration / 10,
      duration / 6,
      0.6,
      ,
      3.14,
      ,
      ,
      ,
      ,
      ,
      0.9,
      ,
      1.9,
      0.46,
    ]
  )
  startJets()
  killTimer = setTimeout(() => killJets(), duration * 1000 * 0.4)
}

const onLand = () => {
  // Get bounds for mando, if he's out of the picture
  // Bring him in.
  let x = MANDO.getBoundingClientRect().x
  if (x > window.innerWidth && x > window.innerWidth / 2)
    x = randomInRange(window.innerWidth / 2, window.innerWidth)
  if (x < 0) x = randomInRange(0, window.innerWidth / 2)
  set(MANDO, { x, y: 0 })
  // Reenable the button
  BTN.removeAttribute('disabled')
  // Show the jetpack flames
  if (killTimer) clearTimeout(killTimer)
  set('.mandalorian__flames', { display: 'block' })
}

const fly = () => {
  const { angle, flip, duration } = getFlightMechanics()
  const shotDelay = Math.random() * (duration / 10) + duration / 10
  const flightAngle = randomInRange(0, 30)
  set(MANDO, {
    rotationY: flip ? 180 : 0,
    rotate: flip ? -flightAngle : flightAngle,
  })
  if (killTimer) clearTimeout(killTimer)
  set('.mandalorian__flames', { display: 'block' })
  TL = new timeline({
    onStart: () => onTakeOff(duration),
    onComplete: onLand,
  })
    .to(
      MANDO,
      {
        duration,
        onUpdate: () => {
          // If Mando is out of bounds, kill the timeline.
          const { top, left, width } = MANDO.getBoundingClientRect()
          if (
            top > window.innerHeight ||
            left < -(width * 1.5) ||
            left > window.innerWidth + width ||
            top < -(width * 1.5)
          ) {
            TL.progress(1)
          }
        },
        physics2D: {
          angle,
          velocity: randomInRange(window.innerHeight * 0.6, window.innerHeight),
          gravity: randomInRange(
            window.innerHeight * 0.25,
            window.innerHeight * 0.5
          ),
        },
      },
      0
    )
    .to(
      [RIGHT_ARM, SHOTS],
      {
        duration: 0.3,
        rotation: `-=${randomInRange(30, 90)}`,
        repeat: 1,
        yoyo: true,
        repeatDelay: shotDelay + 0.6,
      },
      0
    )
    .to(
      [LEFT_ARM],
      {
        duration: 0.3,
        rotation: randomInRange(0, 80),
        repeat: 1,
        yoyo: true,
        repeatDelay: shotDelay + 0.6,
      },
      0
    )
    .to(
      SHOT,
      {
        onStart: () => {
          // eslint-disable-next-line
          zzfx(
            ...[
              ,
              ,
              448,
              0.01,
              0.1,
              0.3,
              3,
              0.39,
              -0.5,
              ,
              ,
              ,
              ,
              ,
              0.2,
              0.1,
              0.08,
            ]
          )
          // zzfx(...[, , 179, , 0.06, 0.47, 2, 2.19, 6.4, , , , , 1, , 0.3])
        },
        onComplete: () => set(SHOT, { x: 0 }),
        onRepeat: () => {
          // eslint-disable-next-line
          zzfx(
            ...[
              ,
              ,
              448,
              0.01,
              0.1,
              0.3,
              3,
              0.39,
              -0.5,
              ,
              ,
              ,
              ,
              ,
              0.2,
              0.1,
              0.08,
            ]
          )
          // zzfx(...[, , 179, , 0.06, 0.47, 2, 2.19, 6.4, , , , , 1, , 0.3])
        },
        duration: 0.2,
        x: '+=50vw',
        opacity: 0,
        repeat: randomInRange(0, 2),
      },
      shotDelay
    )
}

BTN.addEventListener('click', fly)
fly()
              
            
!
999px

Console