npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-spline

v1.0.0

Published

Add Spline animations to your Vue 3 or Nuxt 3 application.

Downloads

695

Readme

Vue 3 Spline

Add Spline animations to your Vue 3 or Nuxt 3 application.

vue3-spline was created to facilitate developers in integrating Spline animations into their Vue 3 applications. During my quest for an uncomplicated method to incorporate Spline animations into my Vue project, I discovered a noticeable absence of up-to-date solutions. vue3-spline serves as a Vue wrapper around the spline-runtime library, enriched with several additional features.

Installation and Usage

Vue 3

  • You can install vue3-spline over yarn, npm or pnpm. spline-runtimeis a dependency ofvue3-splineand should be automatically installed when you installvue3-spline`.

If you are using npm:

npm install vue3-spline@latest --save

If you are using yarn:

yarn add vue3-spline@latest

If you are using pnpm:

pnpm install vue3-spline@latest
  • Register the component in your Vue 3 application.

The most common use case is to register the component globally.

// main.js
import { createApp } from 'vue'
import Vue3Spline from 'vue3-spline'

createApp(App).use(Vue3Spline).mount('#app')

If you get an error with TS, try use(Vue3Spline, { name: "Vue3Spline" })

To define global components for Volar type-checking you will need to add:

// components.d.ts
declare module '@vue/runtime-core' {
  export interface GlobalComponents {
    SplineAnimation: typeof import('vue3-spline')['Vue3Spline']
  }
}
export {}

If needed rename component to use:

app.use(Vue3Spline, { name: 'SplineAnimation' }) // use in template <SplineAnimation />
  • name string (default: 'Vue3Spline') - set custom component name

Alternatively you can also import the component locally.

import { Vue3Spline } from 'vue3-spline'

export default {
  components: {
    Vue3Spline,
  },
}

You can then use the component in your template

<template>
  <Vue3Spline
    :scene="{
      url: 'https://prod.spline.design/VXwvUCucezeKhYSq/scene.splinecode',
    }"
  />
</template>

<script>
import { Vue3Spline } from 'vue3-spline'

export default {
  components: {
    Vue3Spline,
  },
}
</script>

Nuxt 3

This is still experimental. Will be updated soon.

  • You can install vue3-spline over yarn or npm. spline-runtime is a dependency of vue3-spline and should be automatically installed when you install vue3-spline.

If you are using npm:

npm install vue3-spline@latest --save

If you are using yarn:

yarn add vue3-spline@latest
  • Create a folder called plugins at the root of your project.
  • Create a file named Vue3Spline.client.ts inside the plugins directory.
  • Add the following code to the Vue3Spline.client.ts file.
import Vue3Spline from 'vue3-spline'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(Vue3Spline)
})

If you get an error with TS, try use(Vue3Spline, { name: "Vue3Spline" })

This should register as a global component that you can call anywhere in your app under the tag.

I would recommend using a <client-only> parent tag to ensure that the animation only loads in on the client side.

<client-only>
  <Vue3Spline
    :scene="{
      url: 'https://prod.spline.design/VXwvUCucezeKhYSq/scene.splinecode',
    }"
  />
</client-only>