Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
graphics-renderer
Advanced tools
this repository provides tooling for rendering animations where frames are described using svg elements à la react 🙃
this repository provides tooling for rendering animations where frames are described using svg elements à la react 🙃
import React from 'react'
import { AnimationModule } from '../source/models/AnimationModule'
import getColormap from 'colormap'
const HelloRainbowAnimationModule: AnimationModule = {
moduleName: 'Hello-Rainbow',
frameCount: 48,
getFrameDescription: getHelloRainbowFrameDescription,
frameSize: {
width: 1024,
height: 1024,
},
animationSettings: {
frameRate: 12,
constantRateFactor: 1,
},
}
export default HelloRainbowAnimationModule
interface GetHelloRainbowFrameDescriptionApi {
frameCount: number
frameIndex: number
}
async function getHelloRainbowFrameDescription(
api: GetHelloRainbowFrameDescriptionApi
) {
const { frameCount, frameIndex } = api
const rainbowColormap = getColormap({
colormap: 'rainbow-soft',
nshades: frameCount,
format: 'hex',
alpha: 1,
})
const mainFrameColor = rainbowColormap[frameIndex % frameCount]
return (
<svg viewBox={`0 0 100 100`}>
<rect
x={0}
y={0}
width={100}
height={100}
fill={'black'}
stroke={mainFrameColor}
strokeWidth={2}
/>
<text
x={5}
y={9}
style={{
fontFamily: 'monospace',
fontSize: 5,
fill: mainFrameColor,
}}
>
Hello Rainbow
</text>
{new Array(frameCount).fill(null).map((_, circleIndex) => {
const circleStamp = circleIndex / frameCount
return (
<circle
cx={50}
cy={50}
r={30 - 30 * Math.sin(circleStamp * (Math.PI / 2))}
fill={rainbowColormap[(circleIndex + frameIndex) % frameCount]}
/>
)
})}
</svg>
)
}
yarn graphics-renderer startDevelopment --animationModulePath=./example-project/HelloRainbow.animation.tsx
yarn graphics-renderer renderAnimation --animationModulePath=./example-project/HelloRainbow.animation.tsx --animationMp4OutputPath=./example-project/HelloRainbow.mp4"
yarn graphics-renderer convertAnimationToGif --animationMp4SourcePath=./example-project/HelloRainbow.mp4 --animationGifOutputPath=./example-project/HelloRainbow.gif --gifAspectRatioWidth=512
yarn add graphics-renderer
install and run docker engine (the majority of graphics-renderer
runs within a container to simplify dependency management)
graphics-renderer startDevelopment --animationModulePath=<SourceFilePath>
animationModulePath
: path to animation module export file
clientServerPort
: the port on the host machine to use for handling api, asset, and page requests
generatedAssetsDirectoryPath
: path to directory where requested assets will live
numberOfFrameRendererWorkers
: the number of workers to allocate for rendering frames
run startDevelopment command
open browser at localhost:3000
begin making changes on the active animation module
graphics-renderer renderAnimation --animationModulePath=<SourceFilePath> --animationMp4OutputPath=<DirectoryPath>
animationModulePath
: path to animation module export file
animationMp4OutputPath
: path to write .mp4 file
numberOfFrameRendererWorkers
: the number of workers to allocate for rendering frames
graphics-renderer renderAnimationFrame --animationModulePath=<SourceFilePath> --frameFileOutputPath=<FrameFilePath> --frameIndex=<NaturalNumber>
animationModulePath
: path to animation module export file
frameFileOutputPath
: path to write frame file
required
file type can be svg or png
frameIndex
: the index of the frame to render
graphics-renderer convertAnimationToGif --animationMp4SourcePath=<AnimationFilePath> --animationGifOutputPath=<GifFilePath>
animationMp4SourcePath
: path of .mp4 file
animationGifOutputPath
: path to write .gif file
gifAspectRatioWidth
: width of .gif file in pixels
defaultValue = widthOfSourceMp4
aspect ratio will be preserved
FAQs
this repository provides tooling for rendering animations where frames are described using svg elements à la react 🙃
The npm package graphics-renderer receives a total of 3 weekly downloads. As such, graphics-renderer popularity was classified as not popular.
We found that graphics-renderer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.