Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
An operator to interpolate the values of your rxjs streams!
npm install rxjs rx-ease
import { interval } from 'rxjs'
import { take, map, startWith } from 'rxjs/operators'
import ease from 'rx-ease'
const draw = x =>
Array(Math.floor(x))
.fill('#')
.join('')
const progress$ = interval(1000).pipe(
take(1),
map(() => 100),
startWith(0),
ease(120, 18),
map(draw)
)
progress$.subscribe(progress => console.log(progress))
// will log =>
// #
// ####
// ########
// #############
// #################
// ######################
// ##########################
// ##############################
// ##################################
// ######################################
// #########################################
// ############################################
// ##############################################
// ################################################
// ##################################################
// ####################################################
// #####################################################
// ######################################################
// #######################################################
// ########################################################
// #########################################################
// ##########################################################
// ##########################################################
// ##########################################################
// ##########################################################
import { fromEvent } from 'rxjs'
import { map } from 'rxjs/operators'
import ease from 'rx-ease'
const circle = document.querySelector('.circle')
const position$ = fromEvent(document, 'click').pipe(
map(e => ({ x: e.clientX, y: e.clientY })),
ease({
x: [120, 18],
y: [120, 18]
})
)
position$.subscribe(({ x, y }) => {
circle.style.transform = `translate(${x}px, ${y}px)`
})
Similarly to react-motion, rx-ease is a spring animation operator. To configure the animation you need to pass a stiffness and a damping value in an array like [stiffness, damping]
(for example [120, 18]
).
import { interval } from 'rxjs'
import ease from 'rx-ease'
const easedInterval$ = interval(1000).pipe(
map(x => x * 100),
ease([170, 26])
)
import { fromEvent } from 'rxjs'
import ease from 'rx-ease'
const easedMousePosition$ = fromEvent(window, 'mousemove').pipe(
map(e => [e.clientX, e.clientY]),
ease([
[170, 26],
[170, 26],
])
)
import { fromEvent } from 'rxjs'
import ease from 'rx-ease'
const easedMousePosition$ = fromEvent(window, 'mousemove').pipe(
map(e => ({
x: e.clientX,
y: e.clientY]
}),
ease({
x: [170, 26],
y: [170, 26],
})
)
[170, 26]
[120, 14]
[180, 12]
[210, 20]
import ease, { presets } from 'rx-ease'
interval(1000).pipe(
map(x * 100),
ease(...presets.stiff)
)
This was heavily inspired by @chenglou's react-motion.
FAQs
a spring animation operator for rxjs
The npm package rx-ease receives a total of 0 weekly downloads. As such, rx-ease popularity was classified as not popular.
We found that rx-ease demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.