New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

poster-generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poster-generator

纯前端效果封面生成

latest
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

纯前端生成封面效果

badge

badge

就是实现这样的效果

使用

安装

npm i poster-generator

基本用法

import Poster from 'poster-generator';
// 没有注入js,只能手动引入css
import 'poster-generator/dist/index.css';

function App() {
  return (
    <>
      <Poster src='/a8ccb573aeb231c14a84a3c7ea7364431550564.jpg'
        height={350}
        backgroundStyle={{
          backgroundSize: '130vw',
          backgroundPosition: '-69px 5%'
        }}
        test
        content={<Content />} />
    </>
  );
}

function Content() {
  return <div className='content'>
    <h1>强势动力来自</h1>
    <div>
      <div className='content-mask' />
      <span>CNB</span>
    </div>
  </div>
}

demo测试

克隆本仓库

git clone https://cnb.cool/arsrna/os/cover-generator.git
cd cover-generator

安装依赖并启动

pnpm i
pnpm start

访问http://localhost:5173查看效果

开发

包目录在packages/Component.tsxpackages/index.tsx是入口文件

packages/index.module.scss是样式文件。为防止css选择器冲突,这里使用模块化css,在使用tsx组件的时候,要设置className={styles.xxx(xxx为class名)}

API

字段类型是否必填释义默认值
srcstring图片地址
contentReactNode叠层内容
contentStyleCSSProperties叠层内容样式,通过修改 --text-linear-gradient 变量可以实现渐变调节{ '--text-linear-gradient': 'linear-gradient(45deg, #89b8eeff 20%, #e0edffff 80%)' }
backgroundStyleCSSProperties背景样式,修改 background 属性即可更改背景属性
heightCSSProperties['height']图片高度300
scalenumber放大比例,防止 blur 太高边缘失真问题1.08
range[number, number]模糊过渡范围,表示从左到右模糊过渡的阈值[0.2, 0.6]
filter{ mask?: CSSProperties['filter'], background?: CSSProperties['filter'] }遮罩和背景的滤镜效果{ mask: 'blur(20px) saturate(1.5)' }
testboolean是否启用测试遮罩false

Keywords

poster

FAQs

Package last updated on 16 Dec 2025

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