Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crossani/solid

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crossani/solid

A silky smooth declarative animation library for SolidJS.

  • 1.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Solid CrossAni

Bringing the awesome CrossAni transition and animation framework to SolidJS.

Installation

Install @crossani/solid and crossani:

  • npm i crossani @crossani/solid
  • pnpm i crossani @crossani/solid
  • yarn add crossani @crossani/solid

That's it.

Usage

  1. In your component, import EASE from crossani and import solid-crossani, like so:
import { EASE } from "crossani";
import crossani from "@crossani/solid";
// !!!! this may be required to stop vite and/or typescript
// !!!! removing the import even though you do need it
false && crossani; // it will be minified out of your dist.
  1. Create a signal to trigger animations, and add a use:crossani:
export default () => {
  const [triggerAni, setTriggerAni] = createSignal("");

  return <div use:crossani={triggerAni}>{/* ... */}</div>;
};
  1. Add some transitions (see the main CrossAni readme for a better explanation of the transition format):
export default () => {
  const [triggerAni, setTriggerAni] = createSignal("");

  return (
    <div
      use:crossani={triggerAni}
      prop:transitions={{
        default: {
          state: {},
          reset: true,
          cutOff: true,
          ms: 500,
          easing: EASE.inOut,
        },
        alternate: {
          state: { "margin-top": "2rem" },
          ms: 250,
          easing: EASE.out,
        },
      }}
    >
      {/* ... */}
    </div>
  );
};
  1. Run your transitions!!!
export default () => {
  const [triggerAni, setTriggerAni] = createSignal("");

  onMount(() => setTriggerAni("alternate"));

  return (
    <div use:crossani={triggerAni} prop:transitions={/* ... */}>
      {/* ... */}
    </div>
  )
}
  1. OPTIONAL!! Get the current transition state as a signal
export default () => {
  const [triggerAni, setTriggerAni] = createSignal("");
  const [aniState, setAniState] = createSignal();

  return (
    <div use:crossani={[triggerAni, setAniState]} prop:transitions={/* ... */}>
      Current state: {aniState() ?? <em>not animating</em>}

      {/* ... */}
    </div>
  )
}

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc