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

svelte-ken-burns

v0.0.3

Published

This is a CSS-only slideshow for Svelte and SvelteCMS, with configurable per-image pan and zoom settings to create the motion effects popularly associated with American film maker Ken Burns.

Downloads

6

Readme

About Svelte Ken Burns

This is a CSS-only slideshow for Svelte and SvelteCMS, with configurable per-image pan and zoom settings to create the motion effects popularly associated with American film maker Ken Burns.

  • works with Javascript disabled
  • respects prefers-reduced-motion settings
  • click to play / pause
  • works for any number of images
  • supports server-side rendering

Usage as Svelte Component

<script>
import Slideshow from 'svelte-ken-burns'
</script>

<Slideshow {slides} {options} />

The types for slides and options should be avalable when coding, but here they are:

export type PanZoom = {
  x?: number, // the horizontal direction for the focal point, in percentage of width, as a number
  y?: number, // the vertical direction for the focal point, in percentage of height, as a number
  zoom?: number, // the scale applied to the image, as a number, e.g. 1.25 (numbers below 1 will result in borked display)
  tx?: number, // set automatically in the component
  ty?: number, // set automatically in the component
}

export type Slide = KenBurnsImageParams & {
  image: string|{
    src: string
    alt?: string
    [key:string]: Value // Value from SvelteCMS
  }
  start?: PanZoom,
  end?: PanZoom,
}

export type SlideshowOptions = {
  slideDuration:number // how long each slide is visible
  fadeDuration:number // how long the fade-in is when slides transition
  fadeOutDuration:number // set automatically by the component as fadeDuration * 2
  iterations:number|"infinite" // how many times the slideshow cycles
  endOpacity:number // the opacity for the last slide after the slideshow is done cycling
}

Usage with SvelteCMS

///file src/lib/cms.ts
import CMS from 'sveltecms'
import conf from './sveltecms.config.json'
import {kenBurnsPlugin} from 'svelte-ken-burns'
import defaultContent from 'sveltecms/plugins/defaultContent'

const cms = new CMS(conf, [
  defaultContent, // optional but recommended
  kenBurnsPlugin,
  // etc.
])

The SvelteCMS plugin provides the following entities and configurations:

  • FieldTypes
    • panZoom
  • WidgetTypes
    • panZoom
  • Fields
    • slides (type: fieldgroup)
  • Fieldgroups
    • skb_slideshow
  • Components
    • skb:slideshow
    • skb:slideshow-fieldset

To use the plugin, add a Field of type "slides" to any content type, or add a "skb_slideshow" fieldgroup block to any "blocks" field.