New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@losting/timeline

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@losting/timeline

canvas timeline

  • 1.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

timeline

canvas 时间轴,支持缩放、拖拽 preview

使用

npm install @losting/timeline
<!-- fill为 false 时,canvas元素属性width、height必须设置,不能使用style和css -->
<div id="root" style="width: 100%;height: 70px;">
  <canvas id="timeline" style="background-color: rgba(0, 0, 0, .5);"></canvas>
</div>
import MoeTimeline from '@losting/timeline';

// new MoeTimeline(canvasId, options)
const timeline = new MoeTimeline('timeline', {
  fill: true,
});
timeline.draw({
  startTime: 1651823833,
  endTime: 1651910233,
  currentTime: 1651829532,
  areas: [{
    startTime: 1651827433,
    endTime: 1651829413,
    bgColor: '#00AEEC55'
  },{
    startTime: 1651829533,
    endTime: 1651832533,
    bgColor: '#00AEEC55'
  }],
});

timeline.on('timeUpdate', (time) => {
  console.log('selected time:', time);
})

TimeLine options

属性类型默认值说明
textColorstring#ffffff文字颜色
pointColorstring#ffffff刻度颜色
areaColorstring#ffffff55阴影区域背景颜色
centerTimePointColorstring#00aeec当前时间指针颜色
centerTimePointWidthnumber3当前时间指针宽度
spacingnumber5刻度间距
fillbooleanfalse是否适应父容器宽高

事件

方法名说明
draw生成时间轴,参数:object,返回值:无
on事件监听。参数:timeUpdate, 返回值:当前指向时间
draw方法
参数类型是否必填说明
startTimenumber时间轴起始时间
endTimenumber时间轴终止时间
currentTimenumber当前所在时间,默认为起始时间
areasarray阴影区域
areas
参数类型是否必填说明
startTimenumber阴影区域开始时间
endTimenumber阴影区域结束时间点
bgColorstring背景颜色, 默认值:#ffffff55

Keywords

FAQs

Package last updated on 11 May 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