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

@rbxts/ui-motion

v1.2.4

Published

A simple package to animate UI elements in Roblox.

Downloads

3

Readme

✨ UI-Motion ✨

A simple package to create animations for your UI elements in Roblox.

Installation

npm i @rbxts/ui-motion

Usage

Button

import { clickAnimation } from "@rbxts/ui-motion"

// Simple usage

const button = new Instance("TextButton")

clickAnimation({ button })

// If you want animate a UI element when button is clicked

const button = new Instance("TextButton")
const frame = new Instance("Frame")

clickAnimation({ button, content: frame })

Options

  • goals: Edit the goal values of the tween animation.
goals: {
	click: Partial<ExtractMembers<GuiObject, Tweenable>> // --> Default: { Size: UDim2.fromScale(0.9, 0.9) }
	unclick: Partial<ExtractMembers<GuiObject, Tweenable>> // --> Default: { Size: UDim2.fromScale(1, 1) }
}
  • tweenInfo: Edit the tween information.
tweenInfo: TweenInfo // --> Default: new TweenInfo(0.25, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
  • callbacks: Add callbacks for MouseButton1Down and MouseButton1Up events.
callbacks: {
  MouseButton1Down?: () => void // --> Default: undefined
  MouseButton1Up?: () => void // --> Default: undefined
}
Example
clickAnimation(
	{ button },
	{
		callbacks: {
			MouseButton1Down: () => {
				print("Mouse button down")
			},
			MouseButton1Up: () => {
				print("Mouse button up")
			},
		},
		tweenInfo: new TweenInfo(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0.1),
		goals: {
			click: { Transparency: 0.5 },
			unclick: { Transparency: 0 },
		},
	},
)

Hover

import { hoverAnimation } from "@rbxts/ui-motion"

// Simple usage

const button = new Instance("TextButton")

hoverAnimation({ main: button })

// If you want animate a UI element when button is clicked

const button = new Instance("TextButton")
const frame = new Instance("Frame")

hoverAnimation({ main: button, content: frame })

Options

  • goals: Edit the goal values of the tween animation.
goals: {
	hover: Partial<ExtractMembers<GuiObject, Tweenable>> // --> Default: { Size: UDim2.fromScale(0.9, 0.9) }
	unhover: Partial<ExtractMembers<GuiObject, Tweenable>> // --> Default: { Size: UDim2.fromScale(1, 1) }
}
  • tweenInfo: Edit the tween information.
tweenInfo: TweenInfo // --> Default: new TweenInfo(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
  • callbacks: Add callbacks for MouseEnter and MouseLeave events.
callbacks: {
  MouseEnter?: () => void // --> Default: undefined
  MouseLeave?: () => void // --> Default: undefined
}
Example
hoverAnimation(
	{ main: button },
	{
		callbacks: {
			MouseEnter: () => {
				print("Mouse enter")
			},
			MouseLeave: () => {
				print("Mouse leave")
			},
		},
		tweenInfo: new TweenInfo(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0.1),
		goals: { hover: { Rotation: 30 }, unhover: { Rotation: 0 } },
	},
)

Scale

import { scaleUp, scaleDown, customScale } from "@rbxts/ui-motion"

const button = new Instance("TextButton")

scaleUp(button)
scaleDown(button)
customScale(button, 0.7)

Options

  • tweenInfo: Edit the tween information.
tweenInfo: TweenInfo // --> Default: new TweenInfo(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
Example
scaleUp(button, {
	tweenInfo: new TweenInfo(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0.1),
})
customScale(button, 0.9, {
	tweenInfo: new TweenInfo(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0.1),
})